pod 'DVProgressLabel'
import PackageDescription
let package = Package(
name: "MyApp",
dependencies: [
.package(url: "https://github.com/anjaeyoung26/DVProgressLabel.git", from: "0.2.1")
]
)
func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
let progress = Float(totalBytesWritten) / Float(totalBytesExpectedToWrite)
progressMaskLabel.update(progress: progress)
}
You can detect when progress did finished with didFinishMasking
property.
It will be true
when progress
is set to a value greater than or equal to 1.0.
if progressMaskLabel.didFinishMasking {
// Next step
}
You can also get current progress with progress
property.
let progress = progressMaskLabel.progress
You can set stroke color with maskStokeColor
property when the label is being masked.
progressMaskLabel.maskStrokeColor = .green
You can set fill color with maskStokeColor
property when the label is being masked.
progressMaskLabel.maskColor = .white
DVProgressLabel is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 0 |
Last commit: 3 days ago |
Fix package platform version for iOS.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics