To run the example project, clone the repo, and run pod install
from the Example directory first.
// Set initials segments
segmentRecordingView.setInitialSegments(durations: [1.0])
// Start new segment
var duration: TimeInterval = 0.0
segmentRecordingView.startNewSegment()
var timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
duration += 0.1
self.segmentRecordingView.updateSegment(duration: duration)
}
timer.fire()
// Remove current segment
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 1.0) {
timer.invalidate()
self.segmentRecordingView.removeSegment()
}
// Start new segment
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 2.0) {
self.segmentRecordingView.startNewSegment()
duration = 0
timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
duration += 0.1
self.segmentRecordingView.updateSegment(duration: duration)
}
}
// Close current segment
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 5) {
timer.invalidate()
self.segmentRecordingView.closeSegment()
}
- Add this line to your project's
Podfile
(for Swift 5.0)
pod 'SSegmentRecordingView'
- Install the pod
$ pod install
- In Xcode, select File > Swift Packages > Add Package Dependency.
- Follow the prompts using the URL for this repository.
If you have an idea for a new SSegmentRecordingView feature/functionality and want to add it to this repository, feel free to fork the project and create a pull request!
Also, feel free to create an issue if you have any suggestions or need any help
Copyright 2020 Saúl Moreno Abril, [email protected]
SSegmentRecordingView
is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.