Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Xcode10.2 support #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5.0
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
github "Quick/Quick"
github "Quick/Nimble"
github "tarunon/XCTAssertNoLeak" "master"
5 changes: 3 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 5 additions & 2 deletions FluxxKit.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
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" }
s.author = { "keitaoouchi" => "[email protected]" }
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
35 changes: 23 additions & 12 deletions FluxxKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -34,6 +36,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3EB19A4C2250E913003CB523 /* LeatTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeatTests.swift; sourceTree = "<group>"; };
3EB19A4E2250E93F003CB523 /* XCTAssertNoLeak.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTAssertNoLeak.framework; path = Carthage/Build/iOS/XCTAssertNoLeak.framework; sourceTree = "<group>"; };
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 = "<group>"; };
DEC4F37F1EC325EA0008EAC3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -115,6 +120,7 @@
children = (
FC702AB01ED8095700C11174 /* MiddlewareSpec.swift */,
FC702AB11ED8095700C11174 /* StoreSpec.swift */,
3EB19A4C2250E913003CB523 /* LeatTests.swift */,
FC702AA91ED8093C00C11174 /* Info.plist */,
);
path = FluxxKitTests;
Expand All @@ -123,6 +129,7 @@
FC702AB41ED8098E00C11174 /* Frameworks */ = {
isa = PBXGroup;
children = (
3EB19A4E2250E93F003CB523 /* XCTAssertNoLeak.framework */,
FC702AB51ED8098F00C11174 /* Nimble.framework */,
FC702AB61ED8098F00C11174 /* Quick.framework */,
);
Expand Down Expand Up @@ -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 */;
Expand Down Expand Up @@ -277,6 +285,7 @@
buildActionMask = 2147483647;
files = (
FC702AB21ED8095700C11174 /* MiddlewareSpec.swift in Sources */,
3EB19A4D2250E913003CB523 /* LeatTests.swift in Sources */,
FC702AB31ED8095700C11174 /* StoreSpec.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -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";
Expand All @@ -306,13 +316,15 @@
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;
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 @@ -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";
Expand All @@ -365,13 +378,15 @@
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;
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 @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
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 = "1020"
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 = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
5 changes: 0 additions & 5 deletions FluxxKit/Dispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public final class Dispatcher {
self.stores.append(store)
}

@available(*, introduced: 1.0.0, deprecated: 1.0.2, obsoleted: 1.1.0, message: "Please use `unregister(store identifier: String)` instead")
public func unregister(identifier: String) {
self.unregister(store: identifier)
}

public func unregister(store identifier: String) {
precondition(Thread.isMainThread)

Expand Down
54 changes: 54 additions & 0 deletions FluxxKitTests/LeatTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import XCTest
import XCTAssertNoLeak
@testable import FluxxKit

class LeatTests: XCTestCase {

func testNoLeaks() {
let middleware = Middleware()
let store = Store<DummyState, Action>(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)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Maybe, closure styled XCTAssertNoLeak { context in ~~~~ } is appropriate.

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<DummyState, Action> {
override func reduce(state: LeatTests.DummyState, action: LeatTests.Action) {
switch action {
case .dummy:
state.totalCallCount += 1
}
}
}

}