From df0f6398a531863afb7ffa9e3a4f145b17454513 Mon Sep 17 00:00:00 2001 From: "keita.oouchi" Date: Sun, 31 Mar 2019 22:17:48 +0900 Subject: [PATCH] Add support for swift5 --- .swift-version | 2 +- .travis.yml | 4 +- Cartfile.private | 1 + Cartfile.resolved | 5 +- FluxxKit.podspec | 7 ++- FluxxKit.xcodeproj/project.pbxproj | 35 +++++++----- .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../xcshareddata/xcschemes/FluxxKit.xcscheme | 2 +- .../xcschemes/FluxxKitTests.xcscheme | 2 +- FluxxKit/Dispatcher.swift | 5 -- FluxxKitTests/LeatTests.swift | 54 +++++++++++++++++++ 11 files changed, 99 insertions(+), 26 deletions(-) create mode 100644 FluxxKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 FluxxKitTests/LeatTests.swift diff --git a/.swift-version b/.swift-version index 5186d07..819e07a 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +5.0 diff --git a/.travis.yml b/.travis.yml index 8cf89b5..9334f26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ -osx_image: xcode9.3 +osx_image: xcode10.2 language: objective-c before_install: - brew update - brew outdated carthage || brew upgrade carthage - cd Example && bundle install && bundle exec pod repo update && bundle exec pod install && cd ../ install: - - gem install xcpretty --no-rdoc --no-ri --no-document --quiet + - gem install xcpretty script: - swiftlint - set -o pipefail && xcodebuild build -workspace Example/Example.xcworkspace -scheme Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty diff --git a/Cartfile.private b/Cartfile.private index c2786fb..502feb9 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,2 +1,3 @@ github "Quick/Quick" github "Quick/Nimble" +github "tarunon/XCTAssertNoLeak" "master" diff --git a/Cartfile.resolved b/Cartfile.resolved index 521e3f8..51942f4 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,3 @@ -github "Quick/Nimble" "v7.0.2" -github "Quick/Quick" "v1.2.0" +github "Quick/Nimble" "v8.0.1" +github "Quick/Quick" "v2.0.0" +github "tarunon/XCTAssertNoLeak" "40b247b16d658c7e41774a4756f16f331e403976" diff --git a/FluxxKit.podspec b/FluxxKit.podspec index 4554a03..8fee04d 100644 --- a/FluxxKit.podspec +++ b/FluxxKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "FluxxKit" - s.version = "1.1.0" + s.version = "1.2.0" s.summary = "Unidirectional data flow for Reactive programming." s.homepage = "https://github.com/keitaoouchi/FluxxKit" s.license = { :type => "MIT", :file => "LICENSE" } @@ -8,5 +8,8 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/keitaoouchi/FluxxKit.git", :tag => "#{s.version}" } s.source_files = "FluxxKit/*.{swift,h}" s.frameworks = "Foundation" - s.ios.deployment_target = "8.0" + s.ios.deployment_target = "9.0" + s.pod_target_xcconfig = { + "SWIFT_VERSION": "5.0" + } end diff --git a/FluxxKit.xcodeproj/project.pbxproj b/FluxxKit.xcodeproj/project.pbxproj index c70f76e..d40b5ab 100644 --- a/FluxxKit.xcodeproj/project.pbxproj +++ b/FluxxKit.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 3EB19A4D2250E913003CB523 /* LeatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB19A4C2250E913003CB523 /* LeatTests.swift */; }; + 3EDC90932250F4B200F5F0AE /* XCTAssertNoLeak.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EB19A4E2250E93F003CB523 /* XCTAssertNoLeak.framework */; }; DEC4F3801EC325EA0008EAC3 /* FluxKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DEC4F37E1EC325EA0008EAC3 /* FluxKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; DEC4F38D1EC326620008EAC3 /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC4F3861EC326620008EAC3 /* Action.swift */; }; DEC4F38E1EC326620008EAC3 /* Dispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC4F3871EC326620008EAC3 /* Dispatcher.swift */; }; @@ -34,6 +36,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 3EB19A4C2250E913003CB523 /* LeatTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeatTests.swift; sourceTree = ""; }; + 3EB19A4E2250E93F003CB523 /* XCTAssertNoLeak.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTAssertNoLeak.framework; path = Carthage/Build/iOS/XCTAssertNoLeak.framework; sourceTree = ""; }; DEC4F37B1EC325EA0008EAC3 /* FluxxKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FluxxKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DEC4F37E1EC325EA0008EAC3 /* FluxKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FluxKit.h; sourceTree = ""; }; DEC4F37F1EC325EA0008EAC3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -65,6 +69,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3EDC90932250F4B200F5F0AE /* XCTAssertNoLeak.framework in Frameworks */, FC702AB71ED8098F00C11174 /* Nimble.framework in Frameworks */, FC702AB81ED8098F00C11174 /* Quick.framework in Frameworks */, FC702AAA1ED8093C00C11174 /* FluxxKit.framework in Frameworks */, @@ -115,6 +120,7 @@ children = ( FC702AB01ED8095700C11174 /* MiddlewareSpec.swift */, FC702AB11ED8095700C11174 /* StoreSpec.swift */, + 3EB19A4C2250E913003CB523 /* LeatTests.swift */, FC702AA91ED8093C00C11174 /* Info.plist */, ); path = FluxxKitTests; @@ -123,6 +129,7 @@ FC702AB41ED8098E00C11174 /* Frameworks */ = { isa = PBXGroup; children = ( + 3EB19A4E2250E93F003CB523 /* XCTAssertNoLeak.framework */, FC702AB51ED8098F00C11174 /* Nimble.framework */, FC702AB61ED8098F00C11174 /* Quick.framework */, ); @@ -187,27 +194,28 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = com.keita.oouchi; TargetAttributes = { DEC4F37A1EC325EA0008EAC3 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; FC702AA41ED8093C00C11174 = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; }; }; buildConfigurationList = DEC4F3751EC325EA0008EAC3 /* Build configuration list for PBXProject "FluxxKit" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = DEC4F3711EC325EA0008EAC3; productRefGroup = DEC4F37C1EC325EA0008EAC3 /* Products */; @@ -277,6 +285,7 @@ buildActionMask = 2147483647; files = ( FC702AB21ED8095700C11174 /* MiddlewareSpec.swift in Sources */, + 3EB19A4D2250E913003CB523 /* LeatTests.swift in Sources */, FC702AB31ED8095700C11174 /* StoreSpec.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -296,6 +305,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -306,6 +316,7 @@ 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -313,6 +324,7 @@ 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; @@ -355,6 +367,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -365,6 +378,7 @@ 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -372,6 +386,7 @@ 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; @@ -422,8 +437,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -445,8 +459,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -465,8 +478,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -484,8 +496,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.keita.oouchi.FluxxKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/FluxxKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/FluxxKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/FluxxKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/FluxxKit.xcodeproj/xcshareddata/xcschemes/FluxxKit.xcscheme b/FluxxKit.xcodeproj/xcshareddata/xcschemes/FluxxKit.xcscheme index 8ab0ccd..556a1d2 100644 --- a/FluxxKit.xcodeproj/xcshareddata/xcschemes/FluxxKit.xcscheme +++ b/FluxxKit.xcodeproj/xcshareddata/xcschemes/FluxxKit.xcscheme @@ -1,6 +1,6 @@ (reducer: DummyReducer()) + Dispatcher.shared.register(middleware: middleware) + Dispatcher.shared.register(store: store) + Dispatcher.shared.unregister(middleware: Middleware.self) + Dispatcher.shared.unregister(store: store) + + XCTAssertNoLeak(store) + XCTAssertNoLeak(middleware) + } +} + +// MARK: - Test target +private extension LeatTests { + + enum Action: ActionType { + case dummy + } + + class Middleware: MiddlewareType { + + var beforeCallCount = 0 + var afterCallCount = 0 + + func before(dispatch action: ActionType, to store: StoreType) { + self.beforeCallCount += 1 + } + + func after(dispatch action: ActionType, to store: StoreType) { + self.afterCallCount += 1 + } + } + + final class DummyState: StateType { + var totalCallCount = 0 + } + + class DummyReducer: Reducer { + override func reduce(state: LeatTests.DummyState, action: LeatTests.Action) { + switch action { + case .dummy: + state.totalCallCount += 1 + } + } + } + +}