SetupResult
public enum SetupResult<T> : Hashable where T : StorageInterface
The SetupResult
indicates the result of an asynchronous initialization of a persistent store.
The SetupResult
can be treated as a boolean:
try! CoreStore.addStorage(
SQLiteStore(),
completion: { (result: SetupResult) -> Void in
if result {
// succeeded
}
else {
// failed
}
}
)
or as an enum
, where the resulting associated object can also be inspected:
try! CoreStore.addStorage(
SQLiteStore(),
completion: { (result: SetupResult) -> Void in
switch result {
case .success(let storage):
// storage is the related StorageInterface instance
case .failure(let error):
// error is the CoreStoreError enum value for the failure
}
}
)
-
SetupResult.success
indicates that the storage setup succeeded. The associated object for thisenum
value is the relatedStorageInterface
instance.Declaration
Swift
case success(T)
-
SetupResult.failure
indicates that the storage setup failed. The associated object for this value is the relatedCoreStoreError
enum value.Declaration
Swift
case failure(CoreStoreError)
-
Returns
true
if the result indicates.success
,false
if the result is.failure
.Declaration
Swift
public var isSuccess: Bool { get }
-
Declaration
Swift
public static func == <T, U>(lhs: SetupResult<T>, rhs: SetupResult<U>) -> Bool where T : StorageInterface, U : StorageInterface
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
public var debugDescription: String { get }