FileOperationKind
struct FileOperationKind
struct FileOperationKind
import Foundation
class Progress
Progress
is used to report the amount of work done, and provides a way to allow the user to cancel that work.
init(parent parentProgress: Progress?, userInfo userInfoOrNil: [ProgressUserInfoKey : Any]? = nil)
Initializes an instance of Progress
with the specified parent and user info dictionary.
convenience init(totalUnitCount unitCount: Int64)
Initializes an instance of Progress
with a parent of Progress.current()
.
convenience init(totalUnitCount unitCount: Int64, parent: Progress, pendingUnitCount portionOfParentTotalUnitCount: Int64)
Initializes an instance of Progress
with the specified total unit count, parent, and pending unit count.
class func current() -> Progress?
The instance of Progress
associated with the current thread by a previous invocation of becomeCurrent(withPendingUnitCount:)
, if any.
class func discreteProgress(totalUnitCount unitCount: Int64) -> Progress
Initializes an instance of Progress
with a nil
parent.
var cancellationHandler: (() -> Void)? { get set }
A closure to be called when cancel
is called.
var completedUnitCount: Int64 { get set }
The size of the job whose progress is being reported.
var fractionCompleted: Double { get }
The fraction of the overall work completed by this progress object, including work done by any children it may have.
var isCancellable: Bool
Whether the work being done can be cancelled.
var isCancelled: Bool
Whether the work being done has been cancelled.
var isFinished: Bool { get }
Returns true
if the progress is finished.
var isIndeterminate: Bool { get }
Returns true
if the progress is indeterminate.
var isPausable: Bool
Whether the work being done can be paused.
var isPaused: Bool
Whether the work being done has been paused.
var kind: ProgressKind?
Optionally specifies more information about what kind of progress is being reported.
var localizedAdditionalDescription: String! { get }
A more specific description of what progress is being made, fit to present to the user.
var localizedDescription: String! { get }
A description of what progress is being made, fit to present to the user.
var pausingHandler: (() -> Void)? { get set }
A closure to be called when pause is called.
var resumingHandler: (() -> Void)?
A closure to be called when resume is called.
var totalUnitCount: Int64 { get set }
How much of the job has been completed so far.
var userInfo: [ProgressUserInfoKey : Any] { get }
A collection of arbitrary values associated with this Progress
.
func addChild(_ child: Progress, withPendingUnitCount inUnitCount: Int64)
Directly add a child progress to the receiver, assigning it a portion of the receiver’s total unit count.
func becomeCurrent(withPendingUnitCount unitCount: Int64)
Make this Progress
the current thread’s current progress object, returned by Progress.currentProgress()
.
func cancel()
Calls the closure registered with the cancellationHandler
property, if there is one, and set the isCancelled
property to true
.
func pause()
Calls the closure registered with the pausingHandler
property, if there is one, and set the isPaused
property to true
.
func resignCurrent()
Balance the most recent previous invocation of becomeCurrent(withPendingUnitCount:)
on the same thread.
func resume()
Calls the closure registered with the resumingHandler
property, if there is one, and set the isPaused
property to false
.
func setUserInfoObject(_ objectOrNil: Any?, forKey key: ProgressUserInfoKey)
Set a value in the dictionary returned by userInfo
, with appropriate KVO notification for properties whose values can depend on values in the user info dictionary, like localizedDescription
. If a nil value is passed then the dictionary entry is removed.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
protocol Sendable
init(_ rawValue: String)
init(rawValue: String)
static let copying: Progress.FileOperationKind
Use for indicating the progress represents copying a file.
static let decompressingAfterDownloading: Progress.FileOperationKind
Use for indicating the progress represents decompressing after downloading.
static let downloading: Progress.FileOperationKind
Use for indicating the progress represents a download.
static let receiving: Progress.FileOperationKind
Use for indicating the progress represents receiving a file in some way.
let rawValue: String
var hashValue: Int { get }
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
func hash(into hasher: inout Hasher)