Skip to content
This repository has been archived by the owner on Jul 3, 2022. It is now read-only.

Xcode 10/Swift 4.2. Use Result 4.0.0 Fix #192 #193

Merged
merged 2 commits into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: objective-c
osx_image: xcode9
osx_image: xcode10

script:
- xcodebuild test -workspace BrightFutures.xcworkspace -scheme BrightFutures-Mac
- xcodebuild test -workspace BrightFutures.xcworkspace -scheme BrightFutures-iOS -sdk iphonesimulator -destination "platform=iOS Simulator,OS=9.0,name=iPhone 6s"
- xcodebuild test -workspace BrightFutures.xcworkspace -scheme BrightFutures-tvOS -sdk appletvsimulator -destination "OS=9.0,name=Apple TV 1080p"
- xcodebuild test -workspace BrightFutures.xcworkspace -scheme BrightFutures-iOS -sdk iphonesimulator -destination "platform=iOS Simulator,OS=12.0,name=iPhone 6s"
- xcodebuild test -workspace BrightFutures.xcworkspace -scheme BrightFutures-tvOS -sdk appletvsimulator -destination "OS=12.0,name=Apple TV 1080p"
- xcodebuild build -workspace BrightFutures.xcworkspace -scheme BrightFutures-watchOS -sdk watchsimulator

notifications:
Expand Down
6 changes: 3 additions & 3 deletions BrightFutures.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'BrightFutures'
s.version = '6.0.1'
s.version = '6.1.0'
s.license = 'MIT'
s.summary = 'Write great asynchronous code in Swift using futures and promises'
s.homepage = 'https://github.com/Thomvis/BrightFutures'
Expand All @@ -15,9 +15,9 @@ Pod::Spec.new do |s|

s.source_files = 'Sources/BrightFutures/*.swift'

s.dependency 'Result', '~> 3.2.4'
s.dependency 'Result', '~> 4.0.0'

s.requires_arc = true

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }
end
28 changes: 21 additions & 7 deletions BrightFutures.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,12 @@
E98FD6EB1DC3D81600DCD9C9 /* Errors.swift */,
E98FD6EC1DC3D81600DCD9C9 /* ExecutionContext.swift */,
E98FD6ED1DC3D81600DCD9C9 /* Future.swift */,
E98FD6F31DC3D81600DCD9C9 /* Promise.swift */,
E98FD6EE1DC3D81600DCD9C9 /* InvalidationToken.swift */,
E98FD6EF1DC3D81600DCD9C9 /* MutableAsyncType.swift */,
E98FD6F01DC3D81600DCD9C9 /* MutableAsyncType+ResultType.swift */,
E98FD6F11DC3D81600DCD9C9 /* NSOperationQueue+BrightFutures.swift */,
E98FD6F21DC3D81600DCD9C9 /* Number+BrightFutures.swift */,
E98FD6F31DC3D81600DCD9C9 /* Promise.swift */,
E98FD6F41DC3D81600DCD9C9 /* Result+BrightFutures.swift */,
E98FD6F51DC3D81600DCD9C9 /* SequenceType+BrightFutures.swift */,
E9DF0818194470060083F7F2 /* Supporting Files */,
Expand Down Expand Up @@ -550,7 +550,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Thomas Visser";
TargetAttributes = {
E986479C1BF327E400B6BEEE = {
Expand All @@ -574,7 +574,7 @@
};
E9DF0814194470060083F7F2 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0900;
LastSwiftMigration = "";
};
E9DF081F194470060083F7F2 = {
CreatedOnToolsVersion = 6.0;
Expand Down Expand Up @@ -831,6 +831,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down Expand Up @@ -862,6 +863,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -879,6 +881,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "nl.thomvis.BrightFutures-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 4.2;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
Expand All @@ -897,6 +900,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
Expand Down Expand Up @@ -927,6 +931,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
Expand Down Expand Up @@ -959,6 +964,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
Expand Down Expand Up @@ -996,6 +1002,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand Down Expand Up @@ -1028,6 +1035,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -1054,6 +1062,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "nl.thomvis.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -1078,6 +1087,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -1093,12 +1103,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -1130,7 +1142,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -1149,12 +1161,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -1177,7 +1191,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
METAL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -1204,7 +1218,7 @@
INFOPLIST_FILE = Sources/BrightFutures/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "nl.thomvis.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_BUNDLE_IDENTIFIER = nl.thomvis.BrightFutures;
PRODUCT_NAME = BrightFutures;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -1230,7 +1244,7 @@
INFOPLIST_FILE = Sources/BrightFutures/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "nl.thomvis.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_BUNDLE_IDENTIFIER = nl.thomvis.BrightFutures;
PRODUCT_NAME = BrightFutures;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,8 +40,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "antitypical/Result" ~> 3.2.4
github "antitypical/Result" ~> 4.0.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "antitypical/Result" "3.2.4"
github "antitypical/Result" "4.0.0"
4 changes: 2 additions & 2 deletions Sources/BrightFutures/AsyncType+ResultType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public extension AsyncType where Value: ResultProtocol {
}

public var value: Value.Value? {
return result?.value
return result?.result.value
}

public var error: Value.Error? {
return result?.error
return result?.result.error
}

/// Adds the given closure as a callback for when the future succeeds. The closure is executed on the given context.
Expand Down
11 changes: 11 additions & 0 deletions Sources/BrightFutures/Result+BrightFutures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@

import Result

extension ResultProtocol {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that we're adding this here? From what I can tell it doesn't look like this needs to be here in order to fix the issue at hand but that's just from a cursory glance at the Result code. If no, it might be better to put this up on the Result repo rather than this one because I do like the addition

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I need to learn how to read PR descriptions 😅. I do still think that you should put up a PR for this on Result's repo but this is a nice stop gap measure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see, Result framework now encapsulate a Result in a result(resultProtocol)
My others change demonstrate it.

Result framework do not want all this function on the protocol, that’s not the spirit of their modications (composition pattern)

I make it as extension here just to not edit a lot of code, ie. do xxx.result.analysis everywhere


/// Case analysis for Result.
///
/// Returns the value produced by applying `ifFailure` to `failure` Results, or `ifSuccess` to `success` Results.
func analysis<Result>(ifSuccess: (Value) -> Result, ifFailure: (Error) -> Result) -> Result {
return self.result.analysis(ifSuccess: ifSuccess, ifFailure: ifFailure)
}

}

extension ResultProtocol {
/// Enables the chaining of two failable operations where the second operation is asynchronous and
/// represented by a future.
Expand Down