Skip to content

Commit

Permalink
Merge pull request #28 from NicholasTD07/update-to-swift-5.0
Browse files Browse the repository at this point in the history
Update to Swift 5
  • Loading branch information
NicholasTD07 committed Jun 2, 2019
2 parents d71d3e7 + 9f84988 commit 2f4085d
Show file tree
Hide file tree
Showing 23 changed files with 390 additions and 116 deletions.
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Carthage/Build
Carthage/Checkouts

Pods/

fastlane/report.*
fastlane/test_output/

docs/
.build/
build/
Expand All @@ -17,8 +25,3 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate

Carthage/Build
Carthage/Checkouts

Pods/
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
disabled_rules:
- trailing_comma

opt_in_rules:
- empty_count
Expand Down
60 changes: 5 additions & 55 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,13 @@
language: objective-c
osx_image: xcode8
osx_image: xcode10.2
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
- WORKSPACE=TDRedux.xcworkspace
- IOS_FRAMEWORK_SCHEME="TDRedux-iOS"
- WATCHOS_FRAMEWORK_SCHEME="TDRedux-watchOS"
- TVOS_FRAMEWORK_SCHEME="TDRedux-tvOS"
- MACOS_FRAMEWORK_SCHEME="TDRedux-macOS"
- IOS_SDK=iphonesimulator10.0
- WATCHOS_SDK=watchsimulator3.0
- TVOS_SDK=appletvsimulator10.0
- MACOS_SDK=macosx10.12
matrix:
# iOS
- DESTINATION="OS=10.0,name=iPhone SE" RUN_TESTS="YES" UUID="1A6EAD45-0A28-421A-A6D4-AD0866464FAA" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK"
# - DESTINATION="OS=9.3,name=iPhone 6" RUN_TESTS="YES" UUID="79A9445F-18A8-4DD1-A9BB-D2FACE658A81" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK"
# Travis's xcode8 image is in beta and code-signing always times out... sigh...
# - DESTINATION="OS=8.4,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES"

# macOS
- DESTINATION="arch=x86_64" RUN_TESTS="YES" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK="$MACOS_SDK"

# tvOS
- DESTINATION="OS=10.0,name=Apple TV 1080p" RUN_TESTS="YES" UUID="273D776F-196E-4F2A-AEF2-E1E3EAE99B47" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK"
# - DESTINATION="OS=9.0,name=Apple TV 1080p" RUN_TESTS="YES" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK"

# watchOS
- DESTINATION="OS=3.0,name=Apple Watch - 42mm" RUN_TESTS="NO" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK"
- DESTINATION="OS=2.2,name=Apple Watch - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" RUN_TESTS="NO"


# - xcodebuild -workspace TDRedux.xcodeproj -scheme TDRedux -destination "OS=10.0,name=iPhone 6s Plus" GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES test | xcpretty -c

before_install:
install:
- bundle install
- carthage checkout
script:
- set -o pipefail
- xcodebuild -version
- xcodebuild -showsdks
- xcrun simctl list
- xcrun instruments -w "$UUID" || true
- sleep 15 # wait for instruments to start the sim

# Commented out because CI constantly failling for no reason...
# Build Framework in Debug and Run Tests if specified
# - if [ $RUN_TESTS == "YES" ]; then
# xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" test | xcpretty;
# else
# xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" build | xcpretty;
# fi

# Build Framework in Release and Run Tests if specified
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" test | xcpretty;
else
xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO build | xcpretty;
fi
script: ./scripts/test

after_success:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash) -f ./fastlane/test_output/
4 changes: 2 additions & 2 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Quick/Quick" ~> 0.10.0
github "Quick/Nimble" ~> 5.0.0
github "Quick/Quick" ~> 2.0.0
github "Quick/Nimble" ~> 8.0.0
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Quick/Nimble" "v5.0.0"
github "Quick/Quick" "v0.10.0"
github "Quick/Nimble" "v8.0.1"
github "Quick/Quick" "v2.1.0"
13 changes: 13 additions & 0 deletions Config/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Default.xcconfig
// TDRedux
//
// Created by Nicholas Tian on 3/6/19.
// Copyright © 2019 nicktd. All rights reserved.
//

// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974

//:configuration = Debug
SWIFT_VERSION = 5.0
13 changes: 13 additions & 0 deletions Config/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Release.xcconfig
// TDRedux
//
// Created by Nicholas Tian on 3/6/19.
// Copyright © 2019 nicktd. All rights reserved.
//

// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974

//:configuration = Release
SWIFT_VERSION = 5.0
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
159 changes: 159 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
atomos (0.1.3)
babosa (1.0.2)
claide (1.0.2)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
highline (~> 1.7.2)
declarative (0.0.10)
declarative-option (0.1.0)
digest-crc (0.4.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.2)
emoji_regex (1.0.1)
excon (0.64.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.5)
fastlane (2.125.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
bundler (>= 1.12.0, < 3.0.0)
colored
commander-fastlane (>= 4.4.6, < 5.0.0)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (>= 0.1, < 2.0)
excon (>= 0.45.0, < 1.0.0)
faraday (~> 0.9)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 0.9)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-api-client (>= 0.21.2, < 0.24.0)
google-cloud-storage (>= 1.15.0, < 2.0.0)
highline (>= 1.7.2, < 2.0.0)
json (< 3.0.0)
jwt (~> 2.1.0)
mini_magick (~> 4.5.1)
multi_xml (~> 0.5)
multipart-post (~> 2.0.0)
plist (>= 3.1.0, < 4.0.0)
public_suffix (~> 2.0.0)
rubyzip (>= 1.2.2, < 2.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.8.1, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
google-api-client (0.23.9)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.5, < 0.7.0)
httpclient (>= 2.8.1, < 3.0)
mime-types (~> 3.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
signet (~> 0.9)
google-cloud-core (1.3.0)
google-cloud-env (~> 1.0)
google-cloud-env (1.0.5)
faraday (~> 0.11)
google-cloud-storage (1.16.0)
digest-crc (~> 0.4)
google-api-client (~> 0.23)
google-cloud-core (~> 1.2)
googleauth (>= 0.6.2, < 0.10.0)
googleauth (0.6.7)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.7)
highline (1.7.10)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
json (2.2.0)
jwt (2.1.0)
memoist (0.16.0)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mini_magick (4.5.1)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.6)
naturally (2.2.0)
os (1.0.1)
plist (3.5.0)
public_suffix (2.0.5)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rouge (2.0.7)
rubyzip (1.2.3)
security (0.1.3)
signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.5)
CFPropertyList
naturally
slack-notifier (2.3.2)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tty-cursor (0.7.0)
tty-screen (0.7.0)
tty-spinner (0.9.1)
tty-cursor (~> 0.7)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
word_wrap (1.0.0)
xcodeproj (1.9.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.6)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.0)
xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
ruby

DEPENDENCIES
fastlane

BUNDLED WITH
1.17.1
7 changes: 6 additions & 1 deletion Sources/ReducerHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
// Copyright © 2016 nicktd. All rights reserved.
//

// TODO: Use Callable values rather than a function
// Ref https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md

// swiftlint:disable identifier_name
/// Wraps reducers taking non-optional `State` and `SpecificActionType`
/// to take optional `State` and `Any` as its `action` param
///
Expand All @@ -30,13 +34,14 @@ public func Reducer<State, SpecificActionType>(
return reducer(state, action)
}
}
// swiftlint:enable identifier_name

/// Takes an array of `Reducer`s and combine them into one
///
/// - parameter reducers: an array of `Reducer`s who takes and returns the same type of `State`
///
/// - returns: A Reducer function
public func combine<State>(reducers: [(State?, Any) -> State]) -> (State?, Any) -> State {
public func combined<State>(reducers: [(State?, Any) -> State]) -> (State?, Any) -> State {
return { (state: State?, action: Any) -> State in
let reducedState = reducers.reduce(state) { (state, reducer) -> State in
return reducer(state, action)
Expand Down
3 changes: 1 addition & 2 deletions Sources/Store+Subscribe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ extension Store {
}
}


/// The given *UpdateSubscriber* will be called
/// when the *State* of a *Store* changes
///
Expand All @@ -37,7 +36,7 @@ extension Store {
/// - parameter subscriber: A SpecificStateSubscriber function
public func subscribe<SpecificState>(
withConverter converter: @escaping (State) -> SpecificState,
subscriber: @escaping (SpecificState) -> ()
subscriber: @escaping (SpecificState) -> Void
) {
self.subscribe { state in
subscriber(converter(state))
Expand Down
14 changes: 7 additions & 7 deletions Sources/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,17 @@ extension Store {
/// - parameter store: A Store
///
/// - returns: Void
public typealias Subscriber = (_ store: Store) -> ()
public typealias Subscriber = (_ store: Store) -> Void

/// Subscribe to changes of a *Store*'s *State*
///
/// - parameter state: A State
///
/// - returns: Void
public typealias StateSubscriber = (_ state: State) -> ()

public typealias StateSubscriber = (_ state: State) -> Void

/// Gets called every time when the *State* of a *Store* changes
public typealias UpdateSubscriber = () -> ()
public typealias UpdateSubscriber = () -> Void
}

// MARK: - Dispatcher, Dispatch, Middleware and AsyncAction
Expand All @@ -55,22 +54,23 @@ extension Store {
/// - returns: Void
public typealias Dispatcher = (_ store: Store, _ action: Action) -> Void


/// It provides a third-party extension point between dispatching an action,
/// and the moment it reaches the reducer.
///
/// - Requires: Middlewares **MUST** call the Dispatcher that's passed in.
public typealias Middleware = (@escaping Dispatcher) -> Dispatcher

/// Dispatches the given *Action* to the binded *Store*
///
/// - parameter action: An Action will be dispatched to the binded Store
///
/// - returns: Void
public typealias Dispatch = (_ action: Action) -> ()
public typealias Dispatch = (_ action: Action) -> Void

/// Async actions can call the dispatch function
///
/// - parameter dispatch: a Dispatch function
///
/// - returns: Void
public typealias AsyncAction = (_ dispath: @escaping Store.Dispatch) -> ()
public typealias AsyncAction = (_ dispath: @escaping Store.Dispatch) -> Void
}
Loading

0 comments on commit 2f4085d

Please sign in to comment.