# SetupResult Enumeration Reference

# 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
            }
        }
    )

- `success(_:)`

  `SetupResult.success` indicates that the storage setup succeeded. The associated object for this `enum` value is the related `StorageInterface` instance.

  #### Declaration

  Swift

      case success(T)

- `failure(_:)`

  `SetupResult.failure` indicates that the storage setup failed. The associated object for this value is the related `CoreStoreError` enum value.

  #### Declaration

  Swift

      case failure(CoreStoreError)

- `isSuccess`

  Returns `true` if the result indicates `.success`, `false` if the result is `.failure`.

  #### Declaration

  Swift

      public var isSuccess: Bool { get }

### Equatable

- `==(_:_:)`

  #### Declaration

  Swift

      public static func == <T, U>(lhs: SetupResult<T>, rhs: SetupResult<U>) -> Bool where T : StorageInterface, U : StorageInterface

### Hashable

- `hash(into:)`

  #### Declaration

  Swift

      public func hash(into hasher: inout Hasher)

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }