├── .swift-version
├── .gitignore
├── Tests
├── LinuxMain.swift
└── ResultTests
│ ├── NoErrorTests.swift
│ ├── AnyErrorTests.swift
│ ├── Info.plist
│ ├── XCTestManifests.swift
│ └── ResultTests.swift
├── Result.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── xcshareddata
│ └── xcschemes
│ │ ├── Result-tvOS.xcscheme
│ │ ├── Result-watchOS.xcscheme
│ │ ├── Result-Mac.xcscheme
│ │ └── Result-iOS.xcscheme
└── project.pbxproj
├── Result
├── Result.h
├── NoError.swift
├── Info.plist
├── AnyError.swift
├── ResultProtocol.swift
└── Result.swift
├── Package.swift
├── Package@swift-5.swift
├── Result.podspec
├── CONTRIBUTING.md
├── LICENSE
├── .travis.yml
└── README.md
/.swift-version:
--------------------------------------------------------------------------------
1 | 4.2
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | xcuserdata
3 | *.xcuserdatad
4 | *.xccheckout
5 | *.mode*
6 | *.pbxuser
7 |
8 | Carthage/Build
9 | .build
10 |
--------------------------------------------------------------------------------
/Tests/LinuxMain.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | import ResultTests
4 |
5 | var tests = [XCTestCaseEntry]()
6 | tests += ResultTests.__allTests()
7 |
8 | XCTMain(tests)
9 |
--------------------------------------------------------------------------------
/Result.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Result/Result.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015 Rob Rix. All rights reserved.
2 |
3 | /// Project version number for Result.
4 | extern double ResultVersionNumber;
5 |
6 | /// Project version string for Result.
7 | extern const unsigned char ResultVersionString[];
8 |
9 |
--------------------------------------------------------------------------------
/Tests/ResultTests/NoErrorTests.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import XCTest
3 | import Result
4 |
5 | final class NoErrorTests: XCTestCase {
6 | func testEquatable() {
7 | let foo = Result(1)
8 | let bar = Result(1)
9 | XCTAssertTrue(foo == bar)
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Result.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Tests/ResultTests/AnyErrorTests.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import XCTest
3 | import Result
4 |
5 | final class AnyErrorTests: XCTestCase {
6 | func testAnyError() {
7 | let error = Error.a
8 | let anyErrorFromError = AnyError(error)
9 | let anyErrorFromAnyError = AnyError(anyErrorFromError)
10 | XCTAssertTrue(anyErrorFromError == anyErrorFromAnyError)
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:4.0
2 | import PackageDescription
3 |
4 | let package = Package(
5 | name: "Result",
6 | products: [
7 | .library(name: "Result", targets: ["Result"]),
8 | ],
9 | targets: [
10 | .target(name: "Result", dependencies: [], path: "Result"),
11 | .testTarget(name: "ResultTests", dependencies: ["Result"]),
12 | ],
13 | swiftLanguageVersions: [4]
14 | )
15 |
--------------------------------------------------------------------------------
/Package@swift-5.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.0
2 | import PackageDescription
3 |
4 | let package = Package(
5 | name: "Result",
6 | products: [
7 | .library(name: "Result", targets: ["Result"]),
8 | ],
9 | targets: [
10 | .target(name: "Result", dependencies: [], path: "Result"),
11 | .testTarget(name: "ResultTests", dependencies: ["Result"]),
12 | ],
13 | swiftLanguageVersions: [.v4, .v4_2, .v5]
14 | )
15 |
--------------------------------------------------------------------------------
/Result/NoError.swift:
--------------------------------------------------------------------------------
1 | /// An “error” that is impossible to construct.
2 | ///
3 | /// This can be used to describe `Result`s where failures will never
4 | /// be generated. For example, `Result` describes a result that
5 | /// contains an `Int`eger and is guaranteed never to be a `failure`.
6 | #if swift(>=5.0)
7 | @available(*, deprecated, message: "Use `Swift.Never` instead", renamed: "Never")
8 | public enum NoError: Swift.Error, Equatable {
9 | public static func ==(lhs: NoError, rhs: NoError) -> Bool {
10 | return true
11 | }
12 | }
13 | #else
14 | public enum NoError: Swift.Error, Equatable {
15 | public static func ==(lhs: NoError, rhs: NoError) -> Bool {
16 | return true
17 | }
18 | }
19 | #endif
20 |
--------------------------------------------------------------------------------
/Result.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'Result'
3 | s.version = '5.0.0'
4 | s.summary = 'Swift type modelling the success/failure of arbitrary operations'
5 |
6 | s.homepage = 'https://github.com/antitypical/Result'
7 | s.license = { :type => 'MIT', :file => 'LICENSE' }
8 | s.author = { 'Rob Rix' => 'rob.rix@github.com' }
9 | s.source = { :git => 'https://github.com/antitypical/Result.git', :tag => s.version }
10 | s.source_files = 'Result/*.swift'
11 | s.requires_arc = true
12 | s.ios.deployment_target = '8.0'
13 | s.osx.deployment_target = '10.9'
14 | s.watchos.deployment_target = '2.0'
15 | s.tvos.deployment_target = '9.0'
16 |
17 | s.cocoapods_version = '>= 1.4.0'
18 | s.swift_version = '4.2'
19 | end
20 |
--------------------------------------------------------------------------------
/Tests/ResultTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 5.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | We love that you're interested in contributing to this project!
2 |
3 | To make the process as painless as possible, we have just a couple of guidelines
4 | that should make life easier for everyone involved.
5 |
6 | ## Prefer Pull Requests
7 |
8 | If you know exactly how to implement the feature being suggested or fix the bug
9 | being reported, please open a pull request instead of an issue. Pull requests are easier than
10 | patches or inline code blocks for discussing and merging the changes.
11 |
12 | If you can't make the change yourself, please open an issue after making sure
13 | that one isn't already logged.
14 |
15 | ## Contributing Code
16 |
17 | Fork this repository, make it awesomer (preferably in a branch named for the
18 | topic), send a pull request!
19 |
20 | All code contributions should match our [coding
21 | conventions](https://github.com/github/swift-style-guide).
22 |
23 | Thanks for contributing! :boom::camel:
24 |
--------------------------------------------------------------------------------
/Result/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 5.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSHumanReadableCopyright
24 | Copyright © 2015 Rob Rix. All rights reserved.
25 | NSPrincipalClass
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Rob Rix
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/Result/AnyError.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /// A type-erased error which wraps an arbitrary error instance. This should be
4 | /// useful for generic contexts.
5 | public struct AnyError: Swift.Error {
6 | /// The underlying error.
7 | public let error: Swift.Error
8 |
9 | public init(_ error: Swift.Error) {
10 | if let anyError = error as? AnyError {
11 | self = anyError
12 | } else {
13 | self.error = error
14 | }
15 | }
16 | }
17 |
18 | extension AnyError: ErrorConvertible {
19 | public static func error(from error: Error) -> AnyError {
20 | return AnyError(error)
21 | }
22 | }
23 |
24 | extension AnyError: CustomStringConvertible {
25 | public var description: String {
26 | return String(describing: error)
27 | }
28 | }
29 |
30 | extension AnyError: LocalizedError {
31 | public var errorDescription: String? {
32 | return error.localizedDescription
33 | }
34 |
35 | public var failureReason: String? {
36 | return (error as? LocalizedError)?.failureReason
37 | }
38 |
39 | public var helpAnchor: String? {
40 | return (error as? LocalizedError)?.helpAnchor
41 | }
42 |
43 | public var recoverySuggestion: String? {
44 | return (error as? LocalizedError)?.recoverySuggestion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | branches:
2 | only:
3 | - master
4 |
5 | matrix:
6 | include:
7 | - name: CocoaPods Lint
8 | script:
9 | - gem update cocoapods && rm .swift-version && pod lib lint
10 | os: osx
11 | osx_image: xcode10.1
12 | language: objective-c
13 | - &xcode
14 | name: Xcode 9.2 / Swift 4.0
15 | script:
16 | - set -o pipefail
17 | - xcodebuild $XCODE_ACTION -scheme Result-Mac | xcpretty
18 | - xcodebuild $XCODE_ACTION -scheme Result-iOS -sdk iphonesimulator -destination "name=iPhone SE" | xcpretty
19 | - xcodebuild $XCODE_ACTION -scheme Result-tvOS -sdk appletvsimulator -destination "name=Apple TV" | xcpretty
20 | - xcodebuild build -scheme Result-watchOS -sdk watchsimulator | xcpretty
21 | env:
22 | - XCODE_ACTION="build-for-testing test-without-building"
23 | os: osx
24 | osx_image: xcode9.2
25 | language: objective-c
26 | - <<: *xcode
27 | name: Xcode 9.3 / Swift 4.1
28 | osx_image: xcode9.3
29 | - <<: *xcode
30 | name: Xcode 10.1 / Swift 4.2
31 | osx_image: xcode10.1
32 | - <<: *xcode
33 | name: Xcode 10.2 / Swift 5.0
34 | osx_image: xcode10.2
35 | - &swiftpm_darwin
36 | name: SwiftPM / Darwin / Swift 4.0
37 | script:
38 | - swift --version
39 | - swift build
40 | - swift test
41 | env: JOB=SPM
42 | os: osx
43 | osx_image: xcode9.2
44 | language: objective-c
45 | - <<: *swiftpm_darwin
46 | name: SwiftPM / Darwin / Swift 4.1
47 | osx_image: xcode9.3
48 | - <<: *swiftpm_darwin
49 | name: SwiftPM / Darwin / Swift 4.2
50 | osx_image: xcode10.1
51 | - <<: *swiftpm_darwin
52 | name: SwiftPM / Darwin / Swift 5.0
53 | osx_image: xcode10.2
54 | - &swiftpm_linux
55 | name: SwiftPM / Linux / Swift 4.2
56 | script:
57 | - swift --version
58 | - swift build
59 | - swift test
60 | sudo: required
61 | dist: trusty
62 | language: generic
63 | install:
64 | - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
65 | - <<: *swiftpm_linux
66 | name: SwiftPM / Linux / Swift 5.0 Development
67 | env: SWIFT_VERSION=5.0-DEVELOPMENT-SNAPSHOT-2019-02-28-a
68 |
69 | notifications:
70 | email: false
71 |
--------------------------------------------------------------------------------
/Tests/ResultTests/XCTestManifests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | extension AnyErrorTests {
4 | static let __allTests = [
5 | ("testAnyError", testAnyError),
6 | ]
7 | }
8 |
9 | extension NoErrorTests {
10 | static let __allTests = [
11 | ("testEquatable", testEquatable),
12 | ]
13 | }
14 |
15 | extension ResultTests {
16 | static let __allTests = [
17 | ("testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError", testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError),
18 | ("testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError", testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError),
19 | ("testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError", testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError),
20 | ("testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError", testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError),
21 | ("testBimapTransformsFailures", testBimapTransformsFailures),
22 | ("testBimapTransformsSuccesses", testBimapTransformsSuccesses),
23 | ("testErrorsIncludeTheCallingFunction", testErrorsIncludeTheCallingFunction),
24 | ("testErrorsIncludeTheSourceFile", testErrorsIncludeTheSourceFile),
25 | ("testErrorsIncludeTheSourceLine", testErrorsIncludeTheSourceLine),
26 | ("testFanout", testFanout),
27 | ("testInitOptionalFailure", testInitOptionalFailure),
28 | ("testInitOptionalSuccess", testInitOptionalSuccess),
29 | ("testMapRewrapsFailures", testMapRewrapsFailures),
30 | ("testMapTransformsSuccesses", testMapTransformsSuccesses),
31 | ("testMaterializeInferrence", testMaterializeInferrence),
32 | ("testMaterializeProducesFailures", testMaterializeProducesFailures),
33 | ("testMaterializeProducesSuccesses", testMaterializeProducesSuccesses),
34 | ("testRecoverProducesLeftForLeftSuccess", testRecoverProducesLeftForLeftSuccess),
35 | ("testRecoverProducesRightForLeftFailure", testRecoverProducesRightForLeftFailure),
36 | ("testRecoverWithProducesLeftForLeftSuccess", testRecoverWithProducesLeftForLeftSuccess),
37 | ("testRecoverWithProducesRightFailureForLeftFailureAndRightFailure", testRecoverWithProducesRightFailureForLeftFailureAndRightFailure),
38 | ("testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess", testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess),
39 | ("testTryCatchProducesFailures", testTryCatchProducesFailures),
40 | ("testTryCatchProducesSuccesses", testTryCatchProducesSuccesses),
41 | ("testTryCatchWithFunctionCatchProducesFailures", testTryCatchWithFunctionCatchProducesFailures),
42 | ("testTryCatchWithFunctionProducesSuccesses", testTryCatchWithFunctionProducesSuccesses),
43 | ("testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures", testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures),
44 | ("testTryMapProducesFailure", testTryMapProducesFailure),
45 | ("testTryMapProducesSuccess", testTryMapProducesSuccess),
46 | ]
47 | }
48 |
49 | #if !os(macOS)
50 | public func __allTests() -> [XCTestCaseEntry] {
51 | return [
52 | testCase(AnyErrorTests.__allTests),
53 | testCase(NoErrorTests.__allTests),
54 | testCase(ResultTests.__allTests),
55 | ]
56 | }
57 | #endif
58 |
--------------------------------------------------------------------------------
/Result.xcodeproj/xcshareddata/xcschemes/Result-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Result.xcodeproj/xcshareddata/xcschemes/Result-watchOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Result.xcodeproj/xcshareddata/xcschemes/Result-Mac.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
67 |
68 |
78 |
79 |
85 |
86 |
87 |
88 |
89 |
90 |
96 |
97 |
103 |
104 |
105 |
106 |
108 |
109 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/Result.xcodeproj/xcshareddata/xcschemes/Result-iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
67 |
68 |
78 |
79 |
85 |
86 |
87 |
88 |
89 |
90 |
96 |
97 |
103 |
104 |
105 |
106 |
108 |
109 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/Result/ResultProtocol.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015 Rob Rix. All rights reserved.
2 |
3 | /// A protocol that can be used to constrain associated types as `Result`.
4 | public protocol ResultProtocol {
5 | associatedtype Value
6 | associatedtype Error: Swift.Error
7 |
8 | init(value: Value)
9 | init(error: Error)
10 |
11 | var result: Result { get }
12 | }
13 |
14 | extension Result {
15 | /// Returns the value if self represents a success, `nil` otherwise.
16 | public var value: Value? {
17 | switch self {
18 | case let .success(value): return value
19 | case .failure: return nil
20 | }
21 | }
22 |
23 | /// Returns the error if self represents a failure, `nil` otherwise.
24 | public var error: Error? {
25 | switch self {
26 | case .success: return nil
27 | case let .failure(error): return error
28 | }
29 | }
30 |
31 | /// Returns a new Result by mapping `Success`es’ values using `transform`, or re-wrapping `Failure`s’ errors.
32 | public func map(_ transform: (Value) -> U) -> Result {
33 | return flatMap { .success(transform($0)) }
34 | }
35 |
36 | /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors.
37 | public func flatMap(_ transform: (Value) -> Result) -> Result {
38 | switch self {
39 | case let .success(value): return transform(value)
40 | case let .failure(error): return .failure(error)
41 | }
42 | }
43 |
44 | /// Returns a Result with a tuple of the receiver and `other` values if both
45 | /// are `Success`es, or re-wrapping the error of the earlier `Failure`.
46 | public func fanout(_ other: @autoclosure () -> Result) -> Result<(Value, U), Error> {
47 | return self.flatMap { left in other().map { right in (left, right) } }
48 | }
49 |
50 | /// Returns a new Result by mapping `Failure`'s values using `transform`, or re-wrapping `Success`es’ values.
51 | public func mapError(_ transform: (Error) -> Error2) -> Result {
52 | return flatMapError { .failure(transform($0)) }
53 | }
54 |
55 | /// Returns the result of applying `transform` to `Failure`’s errors, or re-wrapping `Success`es’ values.
56 | public func flatMapError(_ transform: (Error) -> Result) -> Result {
57 | switch self {
58 | case let .success(value): return .success(value)
59 | case let .failure(error): return transform(error)
60 | }
61 | }
62 |
63 | /// Returns a new Result by mapping `Success`es’ values using `success`, and by mapping `Failure`'s values using `failure`.
64 | public func bimap(success: (Value) -> U, failure: (Error) -> Error2) -> Result {
65 | switch self {
66 | case let .success(value): return .success(success(value))
67 | case let .failure(error): return .failure(failure(error))
68 | }
69 | }
70 | }
71 |
72 | extension Result {
73 |
74 | // MARK: Higher-order functions
75 |
76 | /// Returns `self.value` if this result is a .Success, or the given value otherwise. Equivalent with `??`
77 | public func recover(_ value: @autoclosure () -> Value) -> Value {
78 | return self.value ?? value()
79 | }
80 |
81 | /// Returns this result if it is a .Success, or the given result otherwise. Equivalent with `??`
82 | public func recover(with result: @autoclosure () -> Result) -> Result {
83 | switch self {
84 | case .success: return self
85 | case .failure: return result()
86 | }
87 | }
88 | }
89 |
90 | /// Protocol used to constrain `tryMap` to `Result`s with compatible `Error`s.
91 | public protocol ErrorConvertible: Swift.Error {
92 | static func error(from error: Swift.Error) -> Self
93 | }
94 |
95 | extension Result where Result.Failure: ErrorConvertible {
96 |
97 | /// Returns the result of applying `transform` to `Success`es’ values, or wrapping thrown errors.
98 | public func tryMap(_ transform: (Value) throws -> U) -> Result {
99 | return flatMap { value in
100 | do {
101 | return .success(try transform(value))
102 | }
103 | catch {
104 | let convertedError = Error.error(from: error)
105 | // Revisit this in a future version of Swift. https://twitter.com/jckarter/status/672931114944696321
106 | return .failure(convertedError)
107 | }
108 | }
109 | }
110 | }
111 |
112 | // MARK: - Operators
113 |
114 | extension Result {
115 | /// Returns the value of `left` if it is a `Success`, or `right` otherwise. Short-circuits.
116 | public static func ??(left: Result, right: @autoclosure () -> Value) -> Value {
117 | return left.recover(right())
118 | }
119 |
120 | /// Returns `left` if it is a `Success`es, or `right` otherwise. Short-circuits.
121 | public static func ??(left: Result, right: @autoclosure () -> Result) -> Result {
122 | return left.recover(with: right())
123 | }
124 | }
125 |
126 | // MARK: - migration support
127 |
128 | @available(*, unavailable, renamed: "ErrorConvertible")
129 | public protocol ErrorProtocolConvertible: ErrorConvertible {}
130 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Result
2 |
3 | [](https://travis-ci.org/antitypical/Result)
4 | [](https://github.com/Carthage/Carthage)
5 | [](https://cocoapods.org/)
6 | [](https://www.versioneye.com/objective-c/result/references)
7 |
8 | This is a Swift µframework providing `Result`.
9 |
10 | `Result` values are either successful (wrapping `Value`) or failed (wrapping `Error`). This is similar to Swift’s native `Optional` type: `success` is like `some`, and `failure` is like `none` except with an associated `Error` value. The addition of an associated `Error` allows errors to be passed along for logging or displaying to the user.
11 |
12 | Using this µframework instead of rolling your own `Result` type allows you to easily interface with other frameworks that also use `Result`.
13 |
14 | ## Use
15 |
16 | Use `Result` whenever an operation has the possibility of failure. Consider the following example of a function that tries to extract a `String` for a given key from a JSON `Dictionary`.
17 |
18 | ```swift
19 | typealias JSONObject = [String: Any]
20 |
21 | enum JSONError: Error {
22 | case noSuchKey(String)
23 | case typeMismatch
24 | }
25 |
26 | func stringForKey(json: JSONObject, key: String) -> Result {
27 | guard let value = json[key] else {
28 | return .failure(.noSuchKey(key))
29 | }
30 |
31 | guard let value = value as? String else {
32 | return .failure(.typeMismatch)
33 | }
34 |
35 | return .success(value)
36 | }
37 | ```
38 |
39 | This function provides a more robust wrapper around the default subscripting provided by `Dictionary`. Rather than return `Any?`, it returns a `Result` that either contains the `String` value for the given key, or an `ErrorType` detailing what went wrong.
40 |
41 | One simple way to handle a `Result` is to deconstruct it using a `switch` statement.
42 |
43 | ```swift
44 | switch stringForKey(json, key: "email") {
45 |
46 | case let .success(email):
47 | print("The email is \(email)")
48 |
49 | case let .failure(.noSuchKey(key)):
50 | print("\(key) is not a valid key")
51 |
52 | case .failure(.typeMismatch):
53 | print("Didn't have the right type")
54 | }
55 | ```
56 |
57 | Using a `switch` statement allows powerful pattern matching, and ensures all possible results are covered. Swift 2.0 offers new ways to deconstruct enums like the `if-case` statement, but be wary as such methods do not ensure errors are handled.
58 |
59 | Other methods available for processing `Result` are detailed in the [API documentation](http://cocoadocs.org/docsets/Result/).
60 |
61 | ## Result vs. Throws
62 |
63 | Swift 2.0 introduces error handling via throwing and catching `Error`. `Result` accomplishes the same goal by encapsulating the result instead of hijacking control flow. The `Result` abstraction enables powerful functionality such as `map` and `flatMap`, making `Result` more composable than `throw`.
64 |
65 | Since dealing with APIs that throw is common, you can convert such functions into a `Result` by using the `materialize` method. Conversely, a `Result` can be used to throw an error by calling `dematerialize`.
66 |
67 | ## Higher Order Functions
68 |
69 | `map` and `flatMap` operate the same as `Optional.map` and `Optional.flatMap` except they apply to `Result`.
70 |
71 | `map` transforms a `Result` into a `Result` of a new type. It does this by taking a function that transforms the `Value` type into a new value. This transformation is only applied in the case of a `success`. In the case of a `failure`, the associated error is re-wrapped in the new `Result`.
72 |
73 | ```swift
74 | // transforms a Result to a Result
75 | let idResult = intForKey(json, key:"id").map { id in String(id) }
76 | ```
77 |
78 | Here, the final result is either the id as a `String`, or carries over the `failure` from the previous result.
79 |
80 | `flatMap` is similar to `map` in that it transforms the `Result` into another `Result`. However, the function passed into `flatMap` must return a `Result`.
81 |
82 | An in depth discussion of `map` and `flatMap` is beyond the scope of this documentation. If you would like a deeper understanding, read about functors and monads. This article is a good place to [start](http://www.javiersoto.me/post/106875422394).
83 |
84 | ## Integration
85 |
86 | ### Carthage
87 |
88 | 1. Add this repository as a submodule and/or [add it to your Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile) if you’re using [carthage](https://github.com/Carthage/Carthage/) to manage your dependencies.
89 | 2. Drag `Result.xcodeproj` into your project or workspace.
90 | 3. Link your target against `Result.framework`.
91 | 4. Application targets should ensure that the framework gets copied into their application bundle. (Framework targets should instead require the application linking them to include Result.)
92 |
93 | ### Cocoapods
94 |
95 | ```ruby
96 | pod 'Result', '~> 5.0'
97 | ```
98 |
99 | ### Swift Package Manager
100 |
101 | ```swift
102 | // swift-tools-version:4.0
103 | import PackageDescription
104 |
105 | let package = Package(
106 | name: "MyProject",
107 | targets: [],
108 | dependencies: [
109 | .package(url: "https://github.com/antitypical/Result.git",
110 | from: "5.0.0")
111 | ]
112 | )
113 | ```
114 |
--------------------------------------------------------------------------------
/Tests/ResultTests/ResultTests.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015 Rob Rix. All rights reserved.
2 |
3 | final class ResultTests: XCTestCase {
4 | func testMapTransformsSuccesses() {
5 | XCTAssertEqual(success.map { $0.count } ?? 0, 7)
6 | }
7 |
8 | func testMapRewrapsFailures() {
9 | XCTAssertEqual(failure.map { $0.count } ?? 0, 0)
10 | }
11 |
12 | func testInitOptionalSuccess() {
13 | XCTAssert(Result("success" as String?, failWith: error) == success)
14 | }
15 |
16 | func testInitOptionalFailure() {
17 | XCTAssert(Result(nil, failWith: error) == failure)
18 | }
19 |
20 | func testFanout() {
21 | let resultSuccess = success.fanout(success)
22 | if let (x, y) = resultSuccess.value {
23 | XCTAssertTrue(x == "success" && y == "success")
24 | } else {
25 | XCTFail()
26 | }
27 |
28 | let resultFailureBoth = failure.fanout(failure2)
29 | XCTAssert(resultFailureBoth.error == error)
30 |
31 | let resultFailureLeft = failure.fanout(success)
32 | XCTAssert(resultFailureLeft.error == error)
33 |
34 | let resultFailureRight = success.fanout(failure2)
35 | XCTAssert(resultFailureRight.error == error2)
36 | }
37 |
38 | func testBimapTransformsSuccesses() {
39 | XCTAssertEqual(success.bimap(
40 | success: { $0.count },
41 | failure: { $0 }
42 | ) ?? 0, 7)
43 | }
44 |
45 | func testBimapTransformsFailures() {
46 | XCTAssert(failure.bimap(
47 | success: { $0 },
48 | failure: { _ in error2 }
49 | ) == failure2)
50 | }
51 |
52 | // MARK: Errors
53 |
54 | func testErrorsIncludeTheSourceFile() {
55 | let file = #file
56 | XCTAssert(Result<(), NSError>.error().file == file)
57 | }
58 |
59 | func testErrorsIncludeTheSourceLine() {
60 | let (line, error) = (#line, Result<(), NSError>.error())
61 | XCTAssertEqual(error.line ?? -1, line)
62 | }
63 |
64 | func testErrorsIncludeTheCallingFunction() {
65 | let function = #function
66 | XCTAssert(Result<(), NSError>.error().function == function)
67 | }
68 |
69 | func testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError() {
70 | XCTAssertEqual(error.errorDescription, "localized description")
71 | XCTAssertEqual(error.localizedDescription, "localized description")
72 | XCTAssertEqual(error3.errorDescription, "localized description")
73 | XCTAssertEqual(error3.localizedDescription, "localized description")
74 | }
75 |
76 | func testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError() {
77 | XCTAssertEqual(error.failureReason, "failure reason")
78 | }
79 |
80 | func testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError() {
81 | XCTAssertEqual(error.recoverySuggestion, "recovery suggestion")
82 | }
83 |
84 | func testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError() {
85 | XCTAssertEqual(error.helpAnchor, "help anchor")
86 | }
87 |
88 | // MARK: Try - Catch
89 |
90 | func testTryCatchProducesSuccesses() {
91 | let result: Result = Result(try tryIsSuccess("success"))
92 | XCTAssert(result == success)
93 | }
94 |
95 | func testTryCatchProducesFailures() {
96 | let result: Result = Result(try tryIsSuccess(nil))
97 | XCTAssert(result.error == error)
98 | }
99 |
100 | func testTryCatchWithFunctionProducesSuccesses() {
101 | let function = { try tryIsSuccess("success") }
102 |
103 | let result: Result = Result(attempt: function)
104 | XCTAssert(result == success)
105 | }
106 |
107 | func testTryCatchWithFunctionCatchProducesFailures() {
108 | let function = { try tryIsSuccess(nil) }
109 |
110 | let result: Result = Result(attempt: function)
111 | XCTAssert(result.error == error)
112 | }
113 |
114 | func testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures() {
115 | let nsError = NSError(domain: "", code: 0)
116 | let function: () throws -> String = { throw nsError }
117 |
118 | let result: Result = Result(attempt: function)
119 | XCTAssert(result.error == AnyError(nsError))
120 | }
121 |
122 | func testMaterializeProducesSuccesses() {
123 | let result1: Result = Result(try tryIsSuccess("success"))
124 | XCTAssert(result1 == success)
125 |
126 | let result2: Result = Result(attempt: { try tryIsSuccess("success") })
127 | XCTAssert(result2 == success)
128 | }
129 |
130 | func testMaterializeProducesFailures() {
131 | let result1: Result = Result(try tryIsSuccess(nil))
132 | XCTAssert(result1.error == error)
133 |
134 | let result2: Result = Result(attempt: { try tryIsSuccess(nil) })
135 | XCTAssert(result2.error == error)
136 | }
137 |
138 | func testMaterializeInferrence() {
139 | let result = Result(attempt: { try tryIsSuccess(nil) })
140 | XCTAssert((type(of: result) as Any.Type) is Result.Type)
141 | }
142 |
143 | // MARK: Recover
144 |
145 | func testRecoverProducesLeftForLeftSuccess() {
146 | let left = Result.success("left")
147 | XCTAssertEqual(left.recover("right"), "left")
148 | }
149 |
150 | func testRecoverProducesRightForLeftFailure() {
151 | let left = Result.failure(Error.a)
152 | XCTAssertEqual(left.recover("right"), "right")
153 | }
154 |
155 | // MARK: Recover With
156 |
157 | func testRecoverWithProducesLeftForLeftSuccess() {
158 | let left = Result.success("left")
159 | let right = Result.success("right")
160 |
161 | XCTAssertEqual(left.recover(with: right).value, "left")
162 | }
163 |
164 | func testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess() {
165 | struct Error: Swift.Error {}
166 |
167 | let left = Result.failure(Error())
168 | let right = Result.success("right")
169 |
170 | XCTAssertEqual(left.recover(with: right).value, "right")
171 | }
172 |
173 | func testRecoverWithProducesRightFailureForLeftFailureAndRightFailure() {
174 | enum Error: Swift.Error { case left, right }
175 |
176 | let left = Result.failure(.left)
177 | let right = Result.failure(.right)
178 |
179 | XCTAssertEqual(left.recover(with: right).error, .right)
180 | }
181 |
182 | func testTryMapProducesSuccess() {
183 | let result = success.tryMap(tryIsSuccess)
184 | XCTAssert(result == success)
185 | }
186 |
187 | func testTryMapProducesFailure() {
188 | let result = Result.success("fail").tryMap(tryIsSuccess)
189 | XCTAssert(result == failure)
190 | }
191 | }
192 |
193 |
194 | // MARK: - Fixtures
195 |
196 | enum Error: Swift.Error, LocalizedError {
197 | case a, b
198 |
199 | var errorDescription: String? {
200 | return "localized description"
201 | }
202 |
203 | var failureReason: String? {
204 | return "failure reason"
205 | }
206 |
207 | var helpAnchor: String? {
208 | return "help anchor"
209 | }
210 |
211 | var recoverySuggestion: String? {
212 | return "recovery suggestion"
213 | }
214 | }
215 |
216 | let success = Result.success("success")
217 | let error = AnyError(Error.a)
218 | let error2 = AnyError(Error.b)
219 | let error3 = AnyError(NSError(domain: "Result", code: 42, userInfo: [NSLocalizedDescriptionKey: "localized description"]))
220 | let failure = Result.failure(error)
221 | let failure2 = Result.failure(error2)
222 |
223 | // MARK: - Helpers
224 |
225 | extension AnyError: Equatable {
226 | public static func ==(lhs: AnyError, rhs: AnyError) -> Bool {
227 | return lhs.error._code == rhs.error._code
228 | && lhs.error._domain == rhs.error._domain
229 | }
230 | }
231 |
232 | func tryIsSuccess(_ text: String?) throws -> String {
233 | guard let text = text, text == "success" else {
234 | throw error
235 | }
236 |
237 | return text
238 | }
239 |
240 | extension NSError {
241 | var function: String? {
242 | return userInfo[Result<(), NSError>.functionKey] as? String
243 | }
244 |
245 | var file: String? {
246 | return userInfo[Result<(), NSError>.fileKey] as? String
247 | }
248 |
249 | var line: Int? {
250 | return userInfo[Result<(), NSError>.lineKey] as? Int
251 | }
252 | }
253 |
254 | import Foundation
255 | import Result
256 | import XCTest
257 |
--------------------------------------------------------------------------------
/Result/Result.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015 Rob Rix. All rights reserved.
2 |
3 | #if swift(>=4.2)
4 | #if compiler(>=5)
5 |
6 | // Use Swift.Result
7 | extension Result {
8 | // ResultProtocol
9 | public typealias Value = Success
10 | public typealias Error = Failure
11 | }
12 |
13 | #else
14 |
15 | /// An enum representing either a failure with an explanatory error, or a success with a result value.
16 | public enum Result {
17 | case success(Value)
18 | case failure(Error)
19 | }
20 |
21 | #endif
22 | #else
23 |
24 | /// An enum representing either a failure with an explanatory error, or a success with a result value.
25 | public enum Result {
26 | case success(Value)
27 | case failure(Error)
28 | }
29 |
30 | #endif
31 |
32 | extension Result {
33 | /// The compatibility alias for the Swift 5's `Result` in the standard library.
34 | ///
35 | /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md
36 | /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603
37 | /// for the details.
38 | public typealias Success = Value
39 | /// The compatibility alias for the Swift 5's `Result` in the standard library.
40 | ///
41 | /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md
42 | /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603
43 | /// for the details.
44 | public typealias Failure = Error
45 | }
46 |
47 | extension Result {
48 | // MARK: Constructors
49 |
50 | /// Constructs a result from an `Optional`, failing with `Error` if `nil`.
51 | public init(_ value: Value?, failWith: @autoclosure () -> Error) {
52 | self = value.map(Result.success) ?? .failure(failWith())
53 | }
54 |
55 | /// Constructs a result from a function that uses `throw`, failing with `Error` if throws.
56 | public init(_ f: @autoclosure () throws -> Value) {
57 | self.init(catching: f)
58 | }
59 |
60 | /// Constructs a result from a function that uses `throw`, failing with `Error` if throws.
61 | @available(*, deprecated, renamed: "init(catching:)")
62 | public init(attempt f: () throws -> Value) {
63 | self.init(catching: f)
64 | }
65 |
66 | /// The same as `init(attempt:)` aiming for the compatibility with the Swift 5's `Result` in the standard library.
67 | ///
68 | /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md
69 | /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603
70 | /// for the details.
71 | public init(catching body: () throws -> Success) {
72 | do {
73 | self = .success(try body())
74 | } catch var error {
75 | if Error.self == AnyError.self {
76 | error = AnyError(error)
77 | }
78 | self = .failure(error as! Error)
79 | }
80 | }
81 |
82 | // MARK: Deconstruction
83 |
84 | /// Returns the value from `success` Results or `throw`s the error.
85 | @available(*, deprecated, renamed: "get()")
86 | public func dematerialize() throws -> Value {
87 | return try get()
88 | }
89 |
90 | /// The same as `dematerialize()` aiming for the compatibility with the Swift 5's `Result` in the standard library.
91 | ///
92 | /// See https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md
93 | /// and https://forums.swift.org/t/accepted-with-modifications-se-0235-add-result-to-the-standard-library/18603
94 | /// for the details.
95 | public func get() throws -> Success {
96 | switch self {
97 | case let .success(value):
98 | return value
99 | case let .failure(error):
100 | throw error
101 | }
102 | }
103 |
104 | /// Case analysis for Result.
105 | ///
106 | /// Returns the value produced by applying `ifFailure` to `failure` Results, or `ifSuccess` to `success` Results.
107 | public func analysis(ifSuccess: (Value) -> Result, ifFailure: (Error) -> Result) -> Result {
108 | switch self {
109 | case let .success(value):
110 | return ifSuccess(value)
111 | case let .failure(value):
112 | return ifFailure(value)
113 | }
114 | }
115 |
116 | // MARK: Errors
117 |
118 | /// The domain for errors constructed by Result.
119 | public static var errorDomain: String { return "com.antitypical.Result" }
120 |
121 | /// The userInfo key for source functions in errors constructed by Result.
122 | public static var functionKey: String { return "\(errorDomain).function" }
123 |
124 | /// The userInfo key for source file paths in errors constructed by Result.
125 | public static var fileKey: String { return "\(errorDomain).file" }
126 |
127 | /// The userInfo key for source file line numbers in errors constructed by Result.
128 | public static var lineKey: String { return "\(errorDomain).line" }
129 |
130 | /// Constructs an error.
131 | public static func error(_ message: String? = nil, function: String = #function, file: String = #file, line: Int = #line) -> NSError {
132 | var userInfo: [String: Any] = [
133 | functionKey: function,
134 | fileKey: file,
135 | lineKey: line,
136 | ]
137 |
138 | if let message = message {
139 | userInfo[NSLocalizedDescriptionKey] = message
140 | }
141 |
142 | return NSError(domain: errorDomain, code: 0, userInfo: userInfo)
143 | }
144 | }
145 |
146 | extension Result: CustomStringConvertible {
147 | public var description: String {
148 | switch self {
149 | case let .success(value): return ".success(\(value))"
150 | case let .failure(error): return ".failure(\(error))"
151 | }
152 | }
153 | }
154 |
155 | extension Result: CustomDebugStringConvertible {
156 | public var debugDescription: String {
157 | return description
158 | }
159 | }
160 |
161 | extension Result: ResultProtocol {
162 | /// Constructs a success wrapping a `value`.
163 | public init(value: Value) {
164 | self = .success(value)
165 | }
166 |
167 | /// Constructs a failure wrapping an `error`.
168 | public init(error: Error) {
169 | self = .failure(error)
170 | }
171 |
172 | public var result: Result {
173 | return self
174 | }
175 | }
176 |
177 | extension Result where Result.Failure == AnyError {
178 | /// Constructs a result from an expression that uses `throw`, failing with `AnyError` if throws.
179 | public init(_ f: @autoclosure () throws -> Value) {
180 | self.init(attempt: f)
181 | }
182 |
183 | /// Constructs a result from a closure that uses `throw`, failing with `AnyError` if throws.
184 | public init(attempt f: () throws -> Value) {
185 | do {
186 | self = .success(try f())
187 | } catch {
188 | self = .failure(AnyError(error))
189 | }
190 | }
191 | }
192 |
193 | // MARK: - Equatable
194 |
195 | #if swift(>=4.2)
196 | #if !compiler(>=5)
197 | extension Result: Equatable where Result.Success: Equatable, Result.Failure: Equatable {}
198 | #endif
199 | #elseif swift(>=4.1)
200 | extension Result: Equatable where Result.Success: Equatable, Result.Failure: Equatable {}
201 | #endif
202 |
203 | #if swift(>=4.2)
204 | // Conformance to `Equatable` will be automatically synthesized.
205 | #else
206 | extension Result where Result.Success: Equatable, Result.Failure: Equatable {
207 | /// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal.
208 | public static func ==(left: Result, right: Result) -> Bool {
209 | if let left = left.value, let right = right.value {
210 | return left == right
211 | } else if let left = left.error, let right = right.error {
212 | return left == right
213 | }
214 | return false
215 | }
216 | }
217 |
218 | extension Result where Result.Success: Equatable, Result.Failure: Equatable {
219 | /// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values.
220 | public static func !=(left: Result, right: Result) -> Bool {
221 | return !(left == right)
222 | }
223 | }
224 | #endif
225 |
226 | // MARK: - Derive result from failable closure
227 |
228 | @available(*, deprecated, renamed: "Result.init(attempt:)")
229 | public func materialize(_ f: () throws -> T) -> Result {
230 | return Result(attempt: f)
231 | }
232 |
233 | @available(*, deprecated, renamed: "Result.init(_:)")
234 | public func materialize(_ f: @autoclosure () throws -> T) -> Result {
235 | return Result(try f())
236 | }
237 |
238 | // MARK: - ErrorConvertible conformance
239 |
240 | extension NSError: ErrorConvertible {
241 | public static func error(from error: Swift.Error) -> Self {
242 | func cast(_ error: Swift.Error) -> T {
243 | return error as! T
244 | }
245 |
246 | return cast(error)
247 | }
248 | }
249 |
250 | // MARK: - migration support
251 |
252 | @available(*, unavailable, message: "Use the overload which returns `Result` instead")
253 | public func materialize(_ f: () throws -> T) -> Result {
254 | fatalError()
255 | }
256 |
257 | @available(*, unavailable, message: "Use the overload which returns `Result` instead")
258 | public func materialize(_ f: @autoclosure () throws -> T) -> Result {
259 | fatalError()
260 | }
261 |
262 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
263 |
264 | /// Constructs a `Result` with the result of calling `try` with an error pointer.
265 | ///
266 | /// This is convenient for wrapping Cocoa API which returns an object or `nil` + an error, by reference. e.g.:
267 | ///
268 | /// Result.try { NSData(contentsOfURL: URL, options: .dataReadingMapped, error: $0) }
269 | @available(*, unavailable, message: "This has been removed. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.")
270 | public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> T?) -> Result {
271 | fatalError()
272 | }
273 |
274 | /// Constructs a `Result` with the result of calling `try` with an error pointer.
275 | ///
276 | /// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.:
277 | ///
278 | /// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) }
279 | @available(*, unavailable, message: "This has been removed. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.")
280 | public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> Bool) -> Result<(), NSError> {
281 | fatalError()
282 | }
283 |
284 | #endif
285 |
286 | // MARK: -
287 |
288 | import Foundation
289 |
--------------------------------------------------------------------------------
/Result.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 45AE89E61B3A6564007B99D7 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; };
11 | 57FCDE3E1BA280DC00130C48 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; };
12 | 57FCDE3F1BA280DC00130C48 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; };
13 | 57FCDE421BA280DC00130C48 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; };
14 | 57FCDE4D1BA280E000130C48 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; };
15 | 57FCDE561BA2814300130C48 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57FCDE471BA280DC00130C48 /* Result.framework */; };
16 | CD333EF21ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; };
17 | CD333EF31ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; };
18 | CD333EF41ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; };
19 | CD333EF51ED50550004D9C5D /* NoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF11ED50550004D9C5D /* NoError.swift */; };
20 | CD333EF71ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; };
21 | CD333EF81ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; };
22 | CD333EF91ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; };
23 | CD333EFA1ED505D7004D9C5D /* AnyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EF61ED505D7004D9C5D /* AnyError.swift */; };
24 | CD333EFC1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; };
25 | CD333EFD1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; };
26 | CD333EFE1ED50699004D9C5D /* NoErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */; };
27 | CD333F001ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; };
28 | CD333F011ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; };
29 | CD333F021ED5074F004D9C5D /* AnyErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */; };
30 | D035799B1B2B788F005D26AE /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; };
31 | D035799E1B2B788F005D26AE /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; };
32 | D454805D1A9572F5009D7229 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; };
33 | D45480681A9572F5009D7229 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D45480571A9572F5009D7229 /* Result.framework */; };
34 | D454806F1A9572F5009D7229 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; };
35 | D45480881A957362009D7229 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D454807D1A957361009D7229 /* Result.framework */; };
36 | D45480971A957465009D7229 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; };
37 | D45480981A957465009D7229 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45480961A957465009D7229 /* Result.swift */; };
38 | D45480991A9574B8009D7229 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D454806E1A9572F5009D7229 /* ResultTests.swift */; };
39 | D454809A1A9574BB009D7229 /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = D454805C1A9572F5009D7229 /* Result.h */; settings = {ATTRIBUTES = (Public, ); }; };
40 | E93621461B35596200948F2A /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; };
41 | E93621471B35596200948F2A /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E93621451B35596200948F2A /* ResultProtocol.swift */; };
42 | /* End PBXBuildFile section */
43 |
44 | /* Begin PBXContainerItemProxy section */
45 | 57FCDE571BA2814A00130C48 /* PBXContainerItemProxy */ = {
46 | isa = PBXContainerItemProxy;
47 | containerPortal = D454804E1A9572F5009D7229 /* Project object */;
48 | proxyType = 1;
49 | remoteGlobalIDString = 57FCDE3C1BA280DC00130C48;
50 | remoteInfo = "Result-tvOS";
51 | };
52 | D45480691A9572F5009D7229 /* PBXContainerItemProxy */ = {
53 | isa = PBXContainerItemProxy;
54 | containerPortal = D454804E1A9572F5009D7229 /* Project object */;
55 | proxyType = 1;
56 | remoteGlobalIDString = D45480561A9572F5009D7229;
57 | remoteInfo = Result;
58 | };
59 | D45480891A957362009D7229 /* PBXContainerItemProxy */ = {
60 | isa = PBXContainerItemProxy;
61 | containerPortal = D454804E1A9572F5009D7229 /* Project object */;
62 | proxyType = 1;
63 | remoteGlobalIDString = D454807C1A957361009D7229;
64 | remoteInfo = "Result-iOS";
65 | };
66 | /* End PBXContainerItemProxy section */
67 |
68 | /* Begin PBXFileReference section */
69 | 57FCDE471BA280DC00130C48 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
70 | 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
71 | CD261ACF1DECFE3400A8863C /* LinuxMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LinuxMain.swift; path = ../LinuxMain.swift; sourceTree = ""; };
72 | CD333EF11ED50550004D9C5D /* NoError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoError.swift; sourceTree = ""; };
73 | CD333EF61ED505D7004D9C5D /* AnyError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyError.swift; sourceTree = ""; };
74 | CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoErrorTests.swift; sourceTree = ""; };
75 | CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyErrorTests.swift; sourceTree = ""; };
76 | D03579A31B2B788F005D26AE /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
77 | D45480571A9572F5009D7229 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
78 | D454805B1A9572F5009D7229 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
79 | D454805C1A9572F5009D7229 /* Result.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Result.h; sourceTree = ""; };
80 | D45480671A9572F5009D7229 /* Result-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
81 | D454806D1A9572F5009D7229 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
82 | D454806E1A9572F5009D7229 /* ResultTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResultTests.swift; sourceTree = ""; };
83 | D454807D1A957361009D7229 /* Result.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; };
84 | D45480871A957362009D7229 /* Result-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Result-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
85 | D45480961A957465009D7229 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; };
86 | E93621451B35596200948F2A /* ResultProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultProtocol.swift; sourceTree = ""; };
87 | /* End PBXFileReference section */
88 |
89 | /* Begin PBXFrameworksBuildPhase section */
90 | 57FCDE401BA280DC00130C48 /* Frameworks */ = {
91 | isa = PBXFrameworksBuildPhase;
92 | buildActionMask = 2147483647;
93 | files = (
94 | );
95 | runOnlyForDeploymentPostprocessing = 0;
96 | };
97 | 57FCDE4E1BA280E000130C48 /* Frameworks */ = {
98 | isa = PBXFrameworksBuildPhase;
99 | buildActionMask = 2147483647;
100 | files = (
101 | 57FCDE561BA2814300130C48 /* Result.framework in Frameworks */,
102 | );
103 | runOnlyForDeploymentPostprocessing = 0;
104 | };
105 | D035799C1B2B788F005D26AE /* Frameworks */ = {
106 | isa = PBXFrameworksBuildPhase;
107 | buildActionMask = 2147483647;
108 | files = (
109 | );
110 | runOnlyForDeploymentPostprocessing = 0;
111 | };
112 | D45480531A9572F5009D7229 /* Frameworks */ = {
113 | isa = PBXFrameworksBuildPhase;
114 | buildActionMask = 2147483647;
115 | files = (
116 | );
117 | runOnlyForDeploymentPostprocessing = 0;
118 | };
119 | D45480641A9572F5009D7229 /* Frameworks */ = {
120 | isa = PBXFrameworksBuildPhase;
121 | buildActionMask = 2147483647;
122 | files = (
123 | D45480681A9572F5009D7229 /* Result.framework in Frameworks */,
124 | );
125 | runOnlyForDeploymentPostprocessing = 0;
126 | };
127 | D45480791A957361009D7229 /* Frameworks */ = {
128 | isa = PBXFrameworksBuildPhase;
129 | buildActionMask = 2147483647;
130 | files = (
131 | );
132 | runOnlyForDeploymentPostprocessing = 0;
133 | };
134 | D45480841A957362009D7229 /* Frameworks */ = {
135 | isa = PBXFrameworksBuildPhase;
136 | buildActionMask = 2147483647;
137 | files = (
138 | D45480881A957362009D7229 /* Result.framework in Frameworks */,
139 | );
140 | runOnlyForDeploymentPostprocessing = 0;
141 | };
142 | /* End PBXFrameworksBuildPhase section */
143 |
144 | /* Begin PBXGroup section */
145 | D454804D1A9572F5009D7229 = {
146 | isa = PBXGroup;
147 | children = (
148 | D45480591A9572F5009D7229 /* Result */,
149 | D454806B1A9572F5009D7229 /* ResultTests */,
150 | D45480581A9572F5009D7229 /* Products */,
151 | );
152 | sourceTree = "";
153 | usesTabs = 1;
154 | };
155 | D45480581A9572F5009D7229 /* Products */ = {
156 | isa = PBXGroup;
157 | children = (
158 | D45480571A9572F5009D7229 /* Result.framework */,
159 | D45480671A9572F5009D7229 /* Result-MacTests.xctest */,
160 | D454807D1A957361009D7229 /* Result.framework */,
161 | D45480871A957362009D7229 /* Result-iOSTests.xctest */,
162 | D03579A31B2B788F005D26AE /* Result.framework */,
163 | 57FCDE471BA280DC00130C48 /* Result.framework */,
164 | 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */,
165 | );
166 | name = Products;
167 | sourceTree = "";
168 | };
169 | D45480591A9572F5009D7229 /* Result */ = {
170 | isa = PBXGroup;
171 | children = (
172 | CD333EF61ED505D7004D9C5D /* AnyError.swift */,
173 | CD333EF11ED50550004D9C5D /* NoError.swift */,
174 | D454805C1A9572F5009D7229 /* Result.h */,
175 | D45480961A957465009D7229 /* Result.swift */,
176 | E93621451B35596200948F2A /* ResultProtocol.swift */,
177 | D454805A1A9572F5009D7229 /* Supporting Files */,
178 | );
179 | path = Result;
180 | sourceTree = "";
181 | };
182 | D454805A1A9572F5009D7229 /* Supporting Files */ = {
183 | isa = PBXGroup;
184 | children = (
185 | D454805B1A9572F5009D7229 /* Info.plist */,
186 | );
187 | name = "Supporting Files";
188 | sourceTree = "";
189 | };
190 | D454806B1A9572F5009D7229 /* ResultTests */ = {
191 | isa = PBXGroup;
192 | children = (
193 | CD333EFF1ED5074F004D9C5D /* AnyErrorTests.swift */,
194 | CD333EFB1ED50699004D9C5D /* NoErrorTests.swift */,
195 | D454806E1A9572F5009D7229 /* ResultTests.swift */,
196 | D454806C1A9572F5009D7229 /* Supporting Files */,
197 | );
198 | name = ResultTests;
199 | path = Tests/ResultTests;
200 | sourceTree = "";
201 | };
202 | D454806C1A9572F5009D7229 /* Supporting Files */ = {
203 | isa = PBXGroup;
204 | children = (
205 | D454806D1A9572F5009D7229 /* Info.plist */,
206 | CD261ACF1DECFE3400A8863C /* LinuxMain.swift */,
207 | );
208 | name = "Supporting Files";
209 | sourceTree = "";
210 | };
211 | /* End PBXGroup section */
212 |
213 | /* Begin PBXHeadersBuildPhase section */
214 | 57FCDE411BA280DC00130C48 /* Headers */ = {
215 | isa = PBXHeadersBuildPhase;
216 | buildActionMask = 2147483647;
217 | files = (
218 | 57FCDE421BA280DC00130C48 /* Result.h in Headers */,
219 | );
220 | runOnlyForDeploymentPostprocessing = 0;
221 | };
222 | D035799D1B2B788F005D26AE /* Headers */ = {
223 | isa = PBXHeadersBuildPhase;
224 | buildActionMask = 2147483647;
225 | files = (
226 | D035799E1B2B788F005D26AE /* Result.h in Headers */,
227 | );
228 | runOnlyForDeploymentPostprocessing = 0;
229 | };
230 | D45480541A9572F5009D7229 /* Headers */ = {
231 | isa = PBXHeadersBuildPhase;
232 | buildActionMask = 2147483647;
233 | files = (
234 | D454805D1A9572F5009D7229 /* Result.h in Headers */,
235 | );
236 | runOnlyForDeploymentPostprocessing = 0;
237 | };
238 | D454807A1A957361009D7229 /* Headers */ = {
239 | isa = PBXHeadersBuildPhase;
240 | buildActionMask = 2147483647;
241 | files = (
242 | D454809A1A9574BB009D7229 /* Result.h in Headers */,
243 | );
244 | runOnlyForDeploymentPostprocessing = 0;
245 | };
246 | /* End PBXHeadersBuildPhase section */
247 |
248 | /* Begin PBXNativeTarget section */
249 | 57FCDE3C1BA280DC00130C48 /* Result-tvOS */ = {
250 | isa = PBXNativeTarget;
251 | buildConfigurationList = 57FCDE441BA280DC00130C48 /* Build configuration list for PBXNativeTarget "Result-tvOS" */;
252 | buildPhases = (
253 | 57FCDE411BA280DC00130C48 /* Headers */,
254 | 57FCDE3D1BA280DC00130C48 /* Sources */,
255 | 57FCDE401BA280DC00130C48 /* Frameworks */,
256 | 57FCDE431BA280DC00130C48 /* Resources */,
257 | );
258 | buildRules = (
259 | );
260 | dependencies = (
261 | );
262 | name = "Result-tvOS";
263 | productName = "Result-iOS";
264 | productReference = 57FCDE471BA280DC00130C48 /* Result.framework */;
265 | productType = "com.apple.product-type.framework";
266 | };
267 | 57FCDE491BA280E000130C48 /* Result-tvOSTests */ = {
268 | isa = PBXNativeTarget;
269 | buildConfigurationList = 57FCDE511BA280E000130C48 /* Build configuration list for PBXNativeTarget "Result-tvOSTests" */;
270 | buildPhases = (
271 | 57FCDE4C1BA280E000130C48 /* Sources */,
272 | 57FCDE4E1BA280E000130C48 /* Frameworks */,
273 | 57FCDE501BA280E000130C48 /* Resources */,
274 | );
275 | buildRules = (
276 | );
277 | dependencies = (
278 | 57FCDE581BA2814A00130C48 /* PBXTargetDependency */,
279 | );
280 | name = "Result-tvOSTests";
281 | productName = "Result-iOSTests";
282 | productReference = 57FCDE541BA280E000130C48 /* Result-tvOSTests.xctest */;
283 | productType = "com.apple.product-type.bundle.unit-test";
284 | };
285 | D03579991B2B788F005D26AE /* Result-watchOS */ = {
286 | isa = PBXNativeTarget;
287 | buildConfigurationList = D03579A01B2B788F005D26AE /* Build configuration list for PBXNativeTarget "Result-watchOS" */;
288 | buildPhases = (
289 | D035799D1B2B788F005D26AE /* Headers */,
290 | D035799A1B2B788F005D26AE /* Sources */,
291 | D035799C1B2B788F005D26AE /* Frameworks */,
292 | D035799F1B2B788F005D26AE /* Resources */,
293 | );
294 | buildRules = (
295 | );
296 | dependencies = (
297 | );
298 | name = "Result-watchOS";
299 | productName = Result;
300 | productReference = D03579A31B2B788F005D26AE /* Result.framework */;
301 | productType = "com.apple.product-type.framework";
302 | };
303 | D45480561A9572F5009D7229 /* Result-Mac */ = {
304 | isa = PBXNativeTarget;
305 | buildConfigurationList = D45480721A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-Mac" */;
306 | buildPhases = (
307 | D45480541A9572F5009D7229 /* Headers */,
308 | D45480521A9572F5009D7229 /* Sources */,
309 | D45480531A9572F5009D7229 /* Frameworks */,
310 | D45480551A9572F5009D7229 /* Resources */,
311 | );
312 | buildRules = (
313 | );
314 | dependencies = (
315 | );
316 | name = "Result-Mac";
317 | productName = Result;
318 | productReference = D45480571A9572F5009D7229 /* Result.framework */;
319 | productType = "com.apple.product-type.framework";
320 | };
321 | D45480661A9572F5009D7229 /* Result-MacTests */ = {
322 | isa = PBXNativeTarget;
323 | buildConfigurationList = D45480751A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-MacTests" */;
324 | buildPhases = (
325 | D45480631A9572F5009D7229 /* Sources */,
326 | D45480641A9572F5009D7229 /* Frameworks */,
327 | D45480651A9572F5009D7229 /* Resources */,
328 | );
329 | buildRules = (
330 | );
331 | dependencies = (
332 | D454806A1A9572F5009D7229 /* PBXTargetDependency */,
333 | );
334 | name = "Result-MacTests";
335 | productName = ResultTests;
336 | productReference = D45480671A9572F5009D7229 /* Result-MacTests.xctest */;
337 | productType = "com.apple.product-type.bundle.unit-test";
338 | };
339 | D454807C1A957361009D7229 /* Result-iOS */ = {
340 | isa = PBXNativeTarget;
341 | buildConfigurationList = D45480941A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOS" */;
342 | buildPhases = (
343 | D454807A1A957361009D7229 /* Headers */,
344 | D45480781A957361009D7229 /* Sources */,
345 | D45480791A957361009D7229 /* Frameworks */,
346 | D454807B1A957361009D7229 /* Resources */,
347 | );
348 | buildRules = (
349 | );
350 | dependencies = (
351 | );
352 | name = "Result-iOS";
353 | productName = "Result-iOS";
354 | productReference = D454807D1A957361009D7229 /* Result.framework */;
355 | productType = "com.apple.product-type.framework";
356 | };
357 | D45480861A957362009D7229 /* Result-iOSTests */ = {
358 | isa = PBXNativeTarget;
359 | buildConfigurationList = D45480951A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOSTests" */;
360 | buildPhases = (
361 | D45480831A957362009D7229 /* Sources */,
362 | D45480841A957362009D7229 /* Frameworks */,
363 | D45480851A957362009D7229 /* Resources */,
364 | );
365 | buildRules = (
366 | );
367 | dependencies = (
368 | D454808A1A957362009D7229 /* PBXTargetDependency */,
369 | );
370 | name = "Result-iOSTests";
371 | productName = "Result-iOSTests";
372 | productReference = D45480871A957362009D7229 /* Result-iOSTests.xctest */;
373 | productType = "com.apple.product-type.bundle.unit-test";
374 | };
375 | /* End PBXNativeTarget section */
376 |
377 | /* Begin PBXProject section */
378 | D454804E1A9572F5009D7229 /* Project object */ = {
379 | isa = PBXProject;
380 | attributes = {
381 | LastSwiftUpdateCheck = 0700;
382 | LastUpgradeCheck = 1020;
383 | ORGANIZATIONNAME = "Rob Rix";
384 | TargetAttributes = {
385 | 57FCDE3C1BA280DC00130C48 = {
386 | LastSwiftMigration = 0920;
387 | };
388 | 57FCDE491BA280E000130C48 = {
389 | LastSwiftMigration = 0920;
390 | };
391 | D03579991B2B788F005D26AE = {
392 | LastSwiftMigration = 0920;
393 | };
394 | D45480561A9572F5009D7229 = {
395 | CreatedOnToolsVersion = 6.3;
396 | LastSwiftMigration = 1020;
397 | };
398 | D45480661A9572F5009D7229 = {
399 | CreatedOnToolsVersion = 6.3;
400 | LastSwiftMigration = 1020;
401 | };
402 | D454807C1A957361009D7229 = {
403 | CreatedOnToolsVersion = 6.3;
404 | LastSwiftMigration = 1000;
405 | };
406 | D45480861A957362009D7229 = {
407 | CreatedOnToolsVersion = 6.3;
408 | LastSwiftMigration = 1000;
409 | };
410 | };
411 | };
412 | buildConfigurationList = D45480511A9572F5009D7229 /* Build configuration list for PBXProject "Result" */;
413 | compatibilityVersion = "Xcode 3.2";
414 | developmentRegion = en;
415 | hasScannedForEncodings = 0;
416 | knownRegions = (
417 | en,
418 | );
419 | mainGroup = D454804D1A9572F5009D7229;
420 | productRefGroup = D45480581A9572F5009D7229 /* Products */;
421 | projectDirPath = "";
422 | projectRoot = "";
423 | targets = (
424 | D45480561A9572F5009D7229 /* Result-Mac */,
425 | D45480661A9572F5009D7229 /* Result-MacTests */,
426 | D454807C1A957361009D7229 /* Result-iOS */,
427 | D45480861A957362009D7229 /* Result-iOSTests */,
428 | 57FCDE3C1BA280DC00130C48 /* Result-tvOS */,
429 | 57FCDE491BA280E000130C48 /* Result-tvOSTests */,
430 | D03579991B2B788F005D26AE /* Result-watchOS */,
431 | );
432 | };
433 | /* End PBXProject section */
434 |
435 | /* Begin PBXResourcesBuildPhase section */
436 | 57FCDE431BA280DC00130C48 /* Resources */ = {
437 | isa = PBXResourcesBuildPhase;
438 | buildActionMask = 2147483647;
439 | files = (
440 | );
441 | runOnlyForDeploymentPostprocessing = 0;
442 | };
443 | 57FCDE501BA280E000130C48 /* Resources */ = {
444 | isa = PBXResourcesBuildPhase;
445 | buildActionMask = 2147483647;
446 | files = (
447 | );
448 | runOnlyForDeploymentPostprocessing = 0;
449 | };
450 | D035799F1B2B788F005D26AE /* Resources */ = {
451 | isa = PBXResourcesBuildPhase;
452 | buildActionMask = 2147483647;
453 | files = (
454 | );
455 | runOnlyForDeploymentPostprocessing = 0;
456 | };
457 | D45480551A9572F5009D7229 /* Resources */ = {
458 | isa = PBXResourcesBuildPhase;
459 | buildActionMask = 2147483647;
460 | files = (
461 | );
462 | runOnlyForDeploymentPostprocessing = 0;
463 | };
464 | D45480651A9572F5009D7229 /* Resources */ = {
465 | isa = PBXResourcesBuildPhase;
466 | buildActionMask = 2147483647;
467 | files = (
468 | );
469 | runOnlyForDeploymentPostprocessing = 0;
470 | };
471 | D454807B1A957361009D7229 /* Resources */ = {
472 | isa = PBXResourcesBuildPhase;
473 | buildActionMask = 2147483647;
474 | files = (
475 | );
476 | runOnlyForDeploymentPostprocessing = 0;
477 | };
478 | D45480851A957362009D7229 /* Resources */ = {
479 | isa = PBXResourcesBuildPhase;
480 | buildActionMask = 2147483647;
481 | files = (
482 | );
483 | runOnlyForDeploymentPostprocessing = 0;
484 | };
485 | /* End PBXResourcesBuildPhase section */
486 |
487 | /* Begin PBXSourcesBuildPhase section */
488 | 57FCDE3D1BA280DC00130C48 /* Sources */ = {
489 | isa = PBXSourcesBuildPhase;
490 | buildActionMask = 2147483647;
491 | files = (
492 | CD333EF41ED50550004D9C5D /* NoError.swift in Sources */,
493 | 57FCDE3E1BA280DC00130C48 /* ResultProtocol.swift in Sources */,
494 | 57FCDE3F1BA280DC00130C48 /* Result.swift in Sources */,
495 | CD333EF91ED505D7004D9C5D /* AnyError.swift in Sources */,
496 | );
497 | runOnlyForDeploymentPostprocessing = 0;
498 | };
499 | 57FCDE4C1BA280E000130C48 /* Sources */ = {
500 | isa = PBXSourcesBuildPhase;
501 | buildActionMask = 2147483647;
502 | files = (
503 | 57FCDE4D1BA280E000130C48 /* ResultTests.swift in Sources */,
504 | CD333F021ED5074F004D9C5D /* AnyErrorTests.swift in Sources */,
505 | CD333EFE1ED50699004D9C5D /* NoErrorTests.swift in Sources */,
506 | );
507 | runOnlyForDeploymentPostprocessing = 0;
508 | };
509 | D035799A1B2B788F005D26AE /* Sources */ = {
510 | isa = PBXSourcesBuildPhase;
511 | buildActionMask = 2147483647;
512 | files = (
513 | CD333EF51ED50550004D9C5D /* NoError.swift in Sources */,
514 | 45AE89E61B3A6564007B99D7 /* ResultProtocol.swift in Sources */,
515 | D035799B1B2B788F005D26AE /* Result.swift in Sources */,
516 | CD333EFA1ED505D7004D9C5D /* AnyError.swift in Sources */,
517 | );
518 | runOnlyForDeploymentPostprocessing = 0;
519 | };
520 | D45480521A9572F5009D7229 /* Sources */ = {
521 | isa = PBXSourcesBuildPhase;
522 | buildActionMask = 2147483647;
523 | files = (
524 | CD333EF21ED50550004D9C5D /* NoError.swift in Sources */,
525 | E93621461B35596200948F2A /* ResultProtocol.swift in Sources */,
526 | D45480971A957465009D7229 /* Result.swift in Sources */,
527 | CD333EF71ED505D7004D9C5D /* AnyError.swift in Sources */,
528 | );
529 | runOnlyForDeploymentPostprocessing = 0;
530 | };
531 | D45480631A9572F5009D7229 /* Sources */ = {
532 | isa = PBXSourcesBuildPhase;
533 | buildActionMask = 2147483647;
534 | files = (
535 | D454806F1A9572F5009D7229 /* ResultTests.swift in Sources */,
536 | CD333F001ED5074F004D9C5D /* AnyErrorTests.swift in Sources */,
537 | CD333EFC1ED50699004D9C5D /* NoErrorTests.swift in Sources */,
538 | );
539 | runOnlyForDeploymentPostprocessing = 0;
540 | };
541 | D45480781A957361009D7229 /* Sources */ = {
542 | isa = PBXSourcesBuildPhase;
543 | buildActionMask = 2147483647;
544 | files = (
545 | CD333EF31ED50550004D9C5D /* NoError.swift in Sources */,
546 | E93621471B35596200948F2A /* ResultProtocol.swift in Sources */,
547 | D45480981A957465009D7229 /* Result.swift in Sources */,
548 | CD333EF81ED505D7004D9C5D /* AnyError.swift in Sources */,
549 | );
550 | runOnlyForDeploymentPostprocessing = 0;
551 | };
552 | D45480831A957362009D7229 /* Sources */ = {
553 | isa = PBXSourcesBuildPhase;
554 | buildActionMask = 2147483647;
555 | files = (
556 | D45480991A9574B8009D7229 /* ResultTests.swift in Sources */,
557 | CD333F011ED5074F004D9C5D /* AnyErrorTests.swift in Sources */,
558 | CD333EFD1ED50699004D9C5D /* NoErrorTests.swift in Sources */,
559 | );
560 | runOnlyForDeploymentPostprocessing = 0;
561 | };
562 | /* End PBXSourcesBuildPhase section */
563 |
564 | /* Begin PBXTargetDependency section */
565 | 57FCDE581BA2814A00130C48 /* PBXTargetDependency */ = {
566 | isa = PBXTargetDependency;
567 | target = 57FCDE3C1BA280DC00130C48 /* Result-tvOS */;
568 | targetProxy = 57FCDE571BA2814A00130C48 /* PBXContainerItemProxy */;
569 | };
570 | D454806A1A9572F5009D7229 /* PBXTargetDependency */ = {
571 | isa = PBXTargetDependency;
572 | target = D45480561A9572F5009D7229 /* Result-Mac */;
573 | targetProxy = D45480691A9572F5009D7229 /* PBXContainerItemProxy */;
574 | };
575 | D454808A1A957362009D7229 /* PBXTargetDependency */ = {
576 | isa = PBXTargetDependency;
577 | target = D454807C1A957361009D7229 /* Result-iOS */;
578 | targetProxy = D45480891A957362009D7229 /* PBXContainerItemProxy */;
579 | };
580 | /* End PBXTargetDependency section */
581 |
582 | /* Begin XCBuildConfiguration section */
583 | 57FCDE451BA280DC00130C48 /* Debug */ = {
584 | isa = XCBuildConfiguration;
585 | buildSettings = {
586 | BITCODE_GENERATION_MODE = bitcode;
587 | CLANG_ENABLE_MODULES = YES;
588 | CODE_SIGN_IDENTITY = "iPhone Developer";
589 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
590 | "CODE_SIGN_IDENTITY[sdk=appletvsimulator*]" = "";
591 | DEFINES_MODULE = YES;
592 | DYLIB_COMPATIBILITY_VERSION = 1;
593 | DYLIB_CURRENT_VERSION = 1;
594 | DYLIB_INSTALL_NAME_BASE = "@rpath";
595 | GCC_PREPROCESSOR_DEFINITIONS = (
596 | "DEBUG=1",
597 | "$(inherited)",
598 | );
599 | INFOPLIST_FILE = Result/Info.plist;
600 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
601 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
602 | PRODUCT_NAME = Result;
603 | SDKROOT = appletvos;
604 | SKIP_INSTALL = YES;
605 | TARGETED_DEVICE_FAMILY = 3;
606 | };
607 | name = Debug;
608 | };
609 | 57FCDE461BA280DC00130C48 /* Release */ = {
610 | isa = XCBuildConfiguration;
611 | buildSettings = {
612 | BITCODE_GENERATION_MODE = bitcode;
613 | CLANG_ENABLE_MODULES = YES;
614 | CODE_SIGN_IDENTITY = "iPhone Developer";
615 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
616 | "CODE_SIGN_IDENTITY[sdk=appletvsimulator*]" = "";
617 | COPY_PHASE_STRIP = NO;
618 | DEFINES_MODULE = YES;
619 | DYLIB_COMPATIBILITY_VERSION = 1;
620 | DYLIB_CURRENT_VERSION = 1;
621 | DYLIB_INSTALL_NAME_BASE = "@rpath";
622 | INFOPLIST_FILE = Result/Info.plist;
623 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
624 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
625 | PRODUCT_NAME = Result;
626 | SDKROOT = appletvos;
627 | SKIP_INSTALL = YES;
628 | TARGETED_DEVICE_FAMILY = 3;
629 | VALIDATE_PRODUCT = YES;
630 | };
631 | name = Release;
632 | };
633 | 57FCDE521BA280E000130C48 /* Debug */ = {
634 | isa = XCBuildConfiguration;
635 | buildSettings = {
636 | APPLICATION_EXTENSION_API_ONLY = NO;
637 | CODE_SIGN_IDENTITY = "iPhone Developer";
638 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
639 | GCC_PREPROCESSOR_DEFINITIONS = (
640 | "DEBUG=1",
641 | "$(inherited)",
642 | );
643 | INFOPLIST_FILE = Tests/ResultTests/Info.plist;
644 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
645 | PRODUCT_NAME = "$(TARGET_NAME)";
646 | SDKROOT = appletvos;
647 | };
648 | name = Debug;
649 | };
650 | 57FCDE531BA280E000130C48 /* Release */ = {
651 | isa = XCBuildConfiguration;
652 | buildSettings = {
653 | APPLICATION_EXTENSION_API_ONLY = NO;
654 | CODE_SIGN_IDENTITY = "iPhone Developer";
655 | COPY_PHASE_STRIP = NO;
656 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
657 | INFOPLIST_FILE = Tests/ResultTests/Info.plist;
658 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
659 | PRODUCT_NAME = "$(TARGET_NAME)";
660 | SDKROOT = appletvos;
661 | VALIDATE_PRODUCT = YES;
662 | };
663 | name = Release;
664 | };
665 | D03579A11B2B788F005D26AE /* Debug */ = {
666 | isa = XCBuildConfiguration;
667 | buildSettings = {
668 | BITCODE_GENERATION_MODE = bitcode;
669 | CLANG_ENABLE_MODULES = YES;
670 | CODE_SIGN_IDENTITY = "iPhone Developer";
671 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
672 | "CODE_SIGN_IDENTITY[sdk=watchsimulator*]" = "";
673 | COMBINE_HIDPI_IMAGES = YES;
674 | DEFINES_MODULE = YES;
675 | DYLIB_COMPATIBILITY_VERSION = 1;
676 | DYLIB_CURRENT_VERSION = 1;
677 | DYLIB_INSTALL_NAME_BASE = "@rpath";
678 | FRAMEWORK_VERSION = A;
679 | INFOPLIST_FILE = Result/Info.plist;
680 | INSTALL_PATH = "@rpath";
681 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
682 | PRODUCT_NAME = Result;
683 | SDKROOT = watchos;
684 | SKIP_INSTALL = YES;
685 | };
686 | name = Debug;
687 | };
688 | D03579A21B2B788F005D26AE /* Release */ = {
689 | isa = XCBuildConfiguration;
690 | buildSettings = {
691 | BITCODE_GENERATION_MODE = bitcode;
692 | CLANG_ENABLE_MODULES = YES;
693 | CODE_SIGN_IDENTITY = "iPhone Developer";
694 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
695 | "CODE_SIGN_IDENTITY[sdk=watchsimulator*]" = "";
696 | COMBINE_HIDPI_IMAGES = YES;
697 | DEFINES_MODULE = YES;
698 | DYLIB_COMPATIBILITY_VERSION = 1;
699 | DYLIB_CURRENT_VERSION = 1;
700 | DYLIB_INSTALL_NAME_BASE = "@rpath";
701 | FRAMEWORK_VERSION = A;
702 | INFOPLIST_FILE = Result/Info.plist;
703 | INSTALL_PATH = "@rpath";
704 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
705 | PRODUCT_NAME = Result;
706 | SDKROOT = watchos;
707 | SKIP_INSTALL = YES;
708 | };
709 | name = Release;
710 | };
711 | D45480701A9572F5009D7229 /* Debug */ = {
712 | isa = XCBuildConfiguration;
713 | buildSettings = {
714 | ALWAYS_SEARCH_USER_PATHS = NO;
715 | APPLICATION_EXTENSION_API_ONLY = YES;
716 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
717 | CLANG_CXX_LIBRARY = "libc++";
718 | CLANG_ENABLE_MODULES = YES;
719 | CLANG_ENABLE_OBJC_ARC = YES;
720 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
721 | CLANG_WARN_BOOL_CONVERSION = YES;
722 | CLANG_WARN_COMMA = YES;
723 | CLANG_WARN_CONSTANT_CONVERSION = YES;
724 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
725 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
726 | CLANG_WARN_EMPTY_BODY = YES;
727 | CLANG_WARN_ENUM_CONVERSION = YES;
728 | CLANG_WARN_INFINITE_RECURSION = YES;
729 | CLANG_WARN_INT_CONVERSION = YES;
730 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
731 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
732 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
733 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
734 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
735 | CLANG_WARN_STRICT_PROTOTYPES = YES;
736 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
737 | CLANG_WARN_UNREACHABLE_CODE = YES;
738 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
739 | COPY_PHASE_STRIP = NO;
740 | CURRENT_PROJECT_VERSION = 1;
741 | DEBUG_INFORMATION_FORMAT = dwarf;
742 | ENABLE_STRICT_OBJC_MSGSEND = YES;
743 | ENABLE_TESTABILITY = YES;
744 | GCC_C_LANGUAGE_STANDARD = gnu99;
745 | GCC_DYNAMIC_NO_PIC = NO;
746 | GCC_NO_COMMON_BLOCKS = YES;
747 | GCC_OPTIMIZATION_LEVEL = 0;
748 | GCC_PREPROCESSOR_DEFINITIONS = (
749 | "DEBUG=1",
750 | "$(inherited)",
751 | );
752 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
753 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
754 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
755 | GCC_WARN_UNDECLARED_SELECTOR = YES;
756 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
757 | GCC_WARN_UNUSED_FUNCTION = YES;
758 | GCC_WARN_UNUSED_VARIABLE = YES;
759 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
760 | MACOSX_DEPLOYMENT_TARGET = 10.9;
761 | MTL_ENABLE_DEBUG_INFO = YES;
762 | ONLY_ACTIVE_ARCH = YES;
763 | PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)";
764 | SDKROOT = macosx;
765 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
766 | SWIFT_SWIFT3_OBJC_INFERENCE = Off;
767 | SWIFT_VERSION = 4.2;
768 | TVOS_DEPLOYMENT_TARGET = 9.0;
769 | VERSIONING_SYSTEM = "apple-generic";
770 | VERSION_INFO_PREFIX = "";
771 | WATCHOS_DEPLOYMENT_TARGET = 2.0;
772 | };
773 | name = Debug;
774 | };
775 | D45480711A9572F5009D7229 /* Release */ = {
776 | isa = XCBuildConfiguration;
777 | buildSettings = {
778 | ALWAYS_SEARCH_USER_PATHS = NO;
779 | APPLICATION_EXTENSION_API_ONLY = YES;
780 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
781 | CLANG_CXX_LIBRARY = "libc++";
782 | CLANG_ENABLE_MODULES = YES;
783 | CLANG_ENABLE_OBJC_ARC = YES;
784 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
785 | CLANG_WARN_BOOL_CONVERSION = YES;
786 | CLANG_WARN_COMMA = YES;
787 | CLANG_WARN_CONSTANT_CONVERSION = YES;
788 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
789 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
790 | CLANG_WARN_EMPTY_BODY = YES;
791 | CLANG_WARN_ENUM_CONVERSION = YES;
792 | CLANG_WARN_INFINITE_RECURSION = YES;
793 | CLANG_WARN_INT_CONVERSION = YES;
794 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
795 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
796 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
797 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
798 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
799 | CLANG_WARN_STRICT_PROTOTYPES = YES;
800 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
801 | CLANG_WARN_UNREACHABLE_CODE = YES;
802 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
803 | COPY_PHASE_STRIP = YES;
804 | CURRENT_PROJECT_VERSION = 1;
805 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
806 | ENABLE_NS_ASSERTIONS = NO;
807 | ENABLE_STRICT_OBJC_MSGSEND = YES;
808 | GCC_C_LANGUAGE_STANDARD = gnu99;
809 | GCC_NO_COMMON_BLOCKS = YES;
810 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
811 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
812 | GCC_WARN_UNDECLARED_SELECTOR = YES;
813 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
814 | GCC_WARN_UNUSED_FUNCTION = YES;
815 | GCC_WARN_UNUSED_VARIABLE = YES;
816 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
817 | MACOSX_DEPLOYMENT_TARGET = 10.9;
818 | MTL_ENABLE_DEBUG_INFO = NO;
819 | PRODUCT_BUNDLE_IDENTIFIER = "com.antitypical.$(PRODUCT_NAME:rfc1034identifier)";
820 | SDKROOT = macosx;
821 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
822 | SWIFT_SWIFT3_OBJC_INFERENCE = Off;
823 | SWIFT_VERSION = 4.2;
824 | TVOS_DEPLOYMENT_TARGET = 9.0;
825 | VERSIONING_SYSTEM = "apple-generic";
826 | VERSION_INFO_PREFIX = "";
827 | WATCHOS_DEPLOYMENT_TARGET = 2.0;
828 | };
829 | name = Release;
830 | };
831 | D45480731A9572F5009D7229 /* Debug */ = {
832 | isa = XCBuildConfiguration;
833 | buildSettings = {
834 | CLANG_ENABLE_MODULES = YES;
835 | COMBINE_HIDPI_IMAGES = YES;
836 | DEFINES_MODULE = YES;
837 | DYLIB_COMPATIBILITY_VERSION = 1;
838 | DYLIB_CURRENT_VERSION = 1;
839 | DYLIB_INSTALL_NAME_BASE = "@rpath";
840 | FRAMEWORK_VERSION = A;
841 | INFOPLIST_FILE = Result/Info.plist;
842 | INSTALL_PATH = "@rpath";
843 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
844 | PRODUCT_NAME = Result;
845 | SKIP_INSTALL = YES;
846 | VALID_ARCHS = x86_64;
847 | };
848 | name = Debug;
849 | };
850 | D45480741A9572F5009D7229 /* Release */ = {
851 | isa = XCBuildConfiguration;
852 | buildSettings = {
853 | CLANG_ENABLE_MODULES = YES;
854 | COMBINE_HIDPI_IMAGES = YES;
855 | DEFINES_MODULE = YES;
856 | DYLIB_COMPATIBILITY_VERSION = 1;
857 | DYLIB_CURRENT_VERSION = 1;
858 | DYLIB_INSTALL_NAME_BASE = "@rpath";
859 | FRAMEWORK_VERSION = A;
860 | INFOPLIST_FILE = Result/Info.plist;
861 | INSTALL_PATH = "@rpath";
862 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
863 | PRODUCT_NAME = Result;
864 | SKIP_INSTALL = YES;
865 | VALID_ARCHS = x86_64;
866 | };
867 | name = Release;
868 | };
869 | D45480761A9572F5009D7229 /* Debug */ = {
870 | isa = XCBuildConfiguration;
871 | buildSettings = {
872 | APPLICATION_EXTENSION_API_ONLY = NO;
873 | COMBINE_HIDPI_IMAGES = YES;
874 | FRAMEWORK_SEARCH_PATHS = (
875 | "$(DEVELOPER_FRAMEWORKS_DIR)",
876 | "$(inherited)",
877 | );
878 | GCC_PREPROCESSOR_DEFINITIONS = (
879 | "DEBUG=1",
880 | "$(inherited)",
881 | );
882 | INFOPLIST_FILE = Tests/ResultTests/Info.plist;
883 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
884 | PRODUCT_NAME = "$(TARGET_NAME)";
885 | };
886 | name = Debug;
887 | };
888 | D45480771A9572F5009D7229 /* Release */ = {
889 | isa = XCBuildConfiguration;
890 | buildSettings = {
891 | APPLICATION_EXTENSION_API_ONLY = NO;
892 | COMBINE_HIDPI_IMAGES = YES;
893 | COPY_PHASE_STRIP = NO;
894 | FRAMEWORK_SEARCH_PATHS = (
895 | "$(DEVELOPER_FRAMEWORKS_DIR)",
896 | "$(inherited)",
897 | );
898 | INFOPLIST_FILE = Tests/ResultTests/Info.plist;
899 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
900 | PRODUCT_NAME = "$(TARGET_NAME)";
901 | };
902 | name = Release;
903 | };
904 | D45480901A957362009D7229 /* Debug */ = {
905 | isa = XCBuildConfiguration;
906 | buildSettings = {
907 | BITCODE_GENERATION_MODE = bitcode;
908 | CLANG_ENABLE_MODULES = YES;
909 | CODE_SIGN_IDENTITY = "iPhone Developer";
910 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
911 | "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = "";
912 | DEFINES_MODULE = YES;
913 | DYLIB_COMPATIBILITY_VERSION = 1;
914 | DYLIB_CURRENT_VERSION = 1;
915 | DYLIB_INSTALL_NAME_BASE = "@rpath";
916 | ENABLE_BITCODE = YES;
917 | GCC_PREPROCESSOR_DEFINITIONS = (
918 | "DEBUG=1",
919 | "$(inherited)",
920 | );
921 | INFOPLIST_FILE = Result/Info.plist;
922 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
923 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
924 | PRODUCT_NAME = Result;
925 | SDKROOT = iphoneos;
926 | SKIP_INSTALL = YES;
927 | TARGETED_DEVICE_FAMILY = "1,2";
928 | };
929 | name = Debug;
930 | };
931 | D45480911A957362009D7229 /* Release */ = {
932 | isa = XCBuildConfiguration;
933 | buildSettings = {
934 | BITCODE_GENERATION_MODE = bitcode;
935 | CLANG_ENABLE_MODULES = YES;
936 | CODE_SIGN_IDENTITY = "iPhone Developer";
937 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
938 | "CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = "";
939 | COPY_PHASE_STRIP = NO;
940 | DEFINES_MODULE = YES;
941 | DYLIB_COMPATIBILITY_VERSION = 1;
942 | DYLIB_CURRENT_VERSION = 1;
943 | DYLIB_INSTALL_NAME_BASE = "@rpath";
944 | ENABLE_BITCODE = YES;
945 | INFOPLIST_FILE = Result/Info.plist;
946 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
947 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
948 | PRODUCT_NAME = Result;
949 | SDKROOT = iphoneos;
950 | SKIP_INSTALL = YES;
951 | TARGETED_DEVICE_FAMILY = "1,2";
952 | VALIDATE_PRODUCT = YES;
953 | };
954 | name = Release;
955 | };
956 | D45480921A957362009D7229 /* Debug */ = {
957 | isa = XCBuildConfiguration;
958 | buildSettings = {
959 | APPLICATION_EXTENSION_API_ONLY = NO;
960 | CODE_SIGN_IDENTITY = "iPhone Developer";
961 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
962 | GCC_PREPROCESSOR_DEFINITIONS = (
963 | "DEBUG=1",
964 | "$(inherited)",
965 | );
966 | INFOPLIST_FILE = Tests/ResultTests/Info.plist;
967 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
968 | PRODUCT_NAME = "$(TARGET_NAME)";
969 | SDKROOT = iphoneos;
970 | };
971 | name = Debug;
972 | };
973 | D45480931A957362009D7229 /* Release */ = {
974 | isa = XCBuildConfiguration;
975 | buildSettings = {
976 | APPLICATION_EXTENSION_API_ONLY = NO;
977 | CODE_SIGN_IDENTITY = "iPhone Developer";
978 | COPY_PHASE_STRIP = NO;
979 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
980 | INFOPLIST_FILE = Tests/ResultTests/Info.plist;
981 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
982 | PRODUCT_NAME = "$(TARGET_NAME)";
983 | SDKROOT = iphoneos;
984 | VALIDATE_PRODUCT = YES;
985 | };
986 | name = Release;
987 | };
988 | /* End XCBuildConfiguration section */
989 |
990 | /* Begin XCConfigurationList section */
991 | 57FCDE441BA280DC00130C48 /* Build configuration list for PBXNativeTarget "Result-tvOS" */ = {
992 | isa = XCConfigurationList;
993 | buildConfigurations = (
994 | 57FCDE451BA280DC00130C48 /* Debug */,
995 | 57FCDE461BA280DC00130C48 /* Release */,
996 | );
997 | defaultConfigurationIsVisible = 0;
998 | defaultConfigurationName = Release;
999 | };
1000 | 57FCDE511BA280E000130C48 /* Build configuration list for PBXNativeTarget "Result-tvOSTests" */ = {
1001 | isa = XCConfigurationList;
1002 | buildConfigurations = (
1003 | 57FCDE521BA280E000130C48 /* Debug */,
1004 | 57FCDE531BA280E000130C48 /* Release */,
1005 | );
1006 | defaultConfigurationIsVisible = 0;
1007 | defaultConfigurationName = Release;
1008 | };
1009 | D03579A01B2B788F005D26AE /* Build configuration list for PBXNativeTarget "Result-watchOS" */ = {
1010 | isa = XCConfigurationList;
1011 | buildConfigurations = (
1012 | D03579A11B2B788F005D26AE /* Debug */,
1013 | D03579A21B2B788F005D26AE /* Release */,
1014 | );
1015 | defaultConfigurationIsVisible = 0;
1016 | defaultConfigurationName = Release;
1017 | };
1018 | D45480511A9572F5009D7229 /* Build configuration list for PBXProject "Result" */ = {
1019 | isa = XCConfigurationList;
1020 | buildConfigurations = (
1021 | D45480701A9572F5009D7229 /* Debug */,
1022 | D45480711A9572F5009D7229 /* Release */,
1023 | );
1024 | defaultConfigurationIsVisible = 0;
1025 | defaultConfigurationName = Release;
1026 | };
1027 | D45480721A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-Mac" */ = {
1028 | isa = XCConfigurationList;
1029 | buildConfigurations = (
1030 | D45480731A9572F5009D7229 /* Debug */,
1031 | D45480741A9572F5009D7229 /* Release */,
1032 | );
1033 | defaultConfigurationIsVisible = 0;
1034 | defaultConfigurationName = Release;
1035 | };
1036 | D45480751A9572F5009D7229 /* Build configuration list for PBXNativeTarget "Result-MacTests" */ = {
1037 | isa = XCConfigurationList;
1038 | buildConfigurations = (
1039 | D45480761A9572F5009D7229 /* Debug */,
1040 | D45480771A9572F5009D7229 /* Release */,
1041 | );
1042 | defaultConfigurationIsVisible = 0;
1043 | defaultConfigurationName = Release;
1044 | };
1045 | D45480941A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOS" */ = {
1046 | isa = XCConfigurationList;
1047 | buildConfigurations = (
1048 | D45480901A957362009D7229 /* Debug */,
1049 | D45480911A957362009D7229 /* Release */,
1050 | );
1051 | defaultConfigurationIsVisible = 0;
1052 | defaultConfigurationName = Release;
1053 | };
1054 | D45480951A957362009D7229 /* Build configuration list for PBXNativeTarget "Result-iOSTests" */ = {
1055 | isa = XCConfigurationList;
1056 | buildConfigurations = (
1057 | D45480921A957362009D7229 /* Debug */,
1058 | D45480931A957362009D7229 /* Release */,
1059 | );
1060 | defaultConfigurationIsVisible = 0;
1061 | defaultConfigurationName = Release;
1062 | };
1063 | /* End XCConfigurationList section */
1064 | };
1065 | rootObject = D454804E1A9572F5009D7229 /* Project object */;
1066 | }
1067 |
--------------------------------------------------------------------------------