Skip to content

Commit 1b9ffee

Browse files
committed
Merge remote-tracking branch 'origin/swift/2.0' into addAnyHandler
2 parents 1e88704 + aba5e20 commit 1b9ffee

39 files changed

+1305
-967
lines changed

.gitignore

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
1-
# Xcode
1+
#--------------------------------------------------------------------------------
2+
# https://github.com/github/gitignore/blob/master/Global/OSX.gitignore
3+
#--------------------------------------------------------------------------------
4+
.DS_Store
5+
.AppleDouble
6+
.LSOverride
7+
8+
# Icon must end with two \r
9+
Icon
10+
11+
# Thumbnails
12+
._*
13+
14+
# Files that might appear in the root of a volume
15+
.DocumentRevisions-V100
16+
.fseventsd
17+
.Spotlight-V100
18+
.TemporaryItems
19+
.Trashes
20+
.VolumeIcon.icns
21+
22+
# Directories potentially created on remote AFP share
23+
.AppleDB
24+
.AppleDesktop
25+
Network Trash Folder
26+
Temporary Items
27+
.apdisk
28+
29+
#--------------------------------------------------------------------------------
30+
# https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore
31+
# https://github.com/github/gitignore/blob/master/Objective-C.gitignore
32+
# https://github.com/github/gitignore/blob/master/Swift.gitignore
33+
#--------------------------------------------------------------------------------
34+
## Build generated
235
build/
36+
DerivedData/
37+
38+
## Various settings
339
*.pbxuser
440
!default.pbxuser
541
*.mode1v3
@@ -8,14 +44,32 @@ build/
844
!default.mode2v3
945
*.perspectivev3
1046
!default.perspectivev3
11-
xcuserdata
12-
*.xccheckout
47+
xcuserdata/
48+
49+
## Other
1350
*.moved-aside
14-
DerivedData
51+
*.xccheckout
52+
*.xcscmblueprint
53+
54+
## Obj-C/Swift specific
1555
*.hmap
1656
*.ipa
17-
*.xcuserstate
1857

58+
## Playgrounds
59+
timeline.xctimeline
60+
playground.xcworkspace
61+
62+
# Swift Package Manager
63+
Packages/
64+
.build/
65+
66+
# CocoaPods
67+
Pods/
68+
69+
# Carthage
1970
Carthage/Build
20-
.build
21-
Packages/
71+
72+
# fastlane
73+
fastlane/report.xml
74+
fastlane/screenshots
75+
fastlane/test_output

.swiftlint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# NOTE:
3+
# To fix `trailing_whitespace` error,
4+
# go to Xcode Preferences -> Text Editing -> turn on both "Automatically trim trailing whitespace" and "Including whitespace-only lines".
5+
#
6+
7+
disabled_rules:
8+
- variable_name_min_length
9+
- line_length
10+
- function_body_length
11+
- type_body_length
12+
- file_length
13+
- cyclomatic_complexity
14+
15+
- opening_brace # prefer Allman-Style
16+
- statement_position # allow `if {}\nelse {}`
17+
- type_name # allow "_" prefix name
18+
- variable_name # allow "_" prefix name
19+
- todo
20+
- valid_docs
21+
22+
opt_in_rules:
23+
- empty_count
24+
25+
#included:
26+
# - Sources
27+
# - Tests
28+
29+
excluded:
30+
- Carthage
31+
- Packages
32+
- Benchmark/Packages
33+
34+
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ import PackageDescription
1010

1111
let package = Package(
1212
name: "SwiftState"
13-
)
13+
)

Sources/Disposable.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//
88

99
//
10-
// NOTE:
10+
// NOTE:
1111
// This file is a partial copy from ReactiveCocoa v4.0.0-alpha.4 (removing `Atomic` dependency),
12-
// which has not been taken out as microframework yet.
12+
// which has not been taken out as microframework.
1313
// https://github.com/ReactiveCocoa/ReactiveCocoa/issues/2579
1414
//
1515
// Note that `ActionDisposable` also works as `() -> ()` wrapper to help suppressing warning:
@@ -19,27 +19,27 @@
1919
/// Represents something that can be “disposed,” usually associated with freeing
2020
/// resources or canceling work.
2121
public protocol Disposable {
22-
/// Whether this disposable has been disposed already.
23-
var disposed: Bool { get }
22+
/// Whether this disposable has been disposed already.
23+
var disposed: Bool { get }
2424

25-
func dispose()
25+
func dispose()
2626
}
2727

2828
/// A disposable that will run an action upon disposal.
2929
public final class ActionDisposable: Disposable {
30-
private var action: (() -> ())?
30+
private var action: (() -> ())?
3131

32-
public var disposed: Bool {
33-
return action == nil
34-
}
32+
public var disposed: Bool {
33+
return action == nil
34+
}
3535

36-
/// Initializes the disposable to run the given action upon disposal.
37-
public init(action: () -> ()) {
38-
self.action = action
39-
}
36+
/// Initializes the disposable to run the given action upon disposal.
37+
public init(action: () -> ()) {
38+
self.action = action
39+
}
4040

41-
public func dispose() {
42-
self.action?()
41+
public func dispose() {
42+
self.action?()
4343
self.action = nil
44-
}
45-
}
44+
}
45+
}

Sources/EventType.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extension Event: RawRepresentable
3939
self = .Any
4040
}
4141
}
42-
42+
4343
public var rawValue: E?
4444
{
4545
switch self {
@@ -63,12 +63,22 @@ public func == <E: EventType>(lhs: Event<E>, rhs: Event<E>) -> Bool
6363

6464
public func == <E: EventType>(lhs: Event<E>, rhs: E) -> Bool
6565
{
66-
return lhs.hashValue == rhs.hashValue
66+
switch lhs {
67+
case .Some(let x):
68+
return x == rhs
69+
case .Any:
70+
return false
71+
}
6772
}
6873

6974
public func == <E: EventType>(lhs: E, rhs: Event<E>) -> Bool
7075
{
71-
return lhs.hashValue == rhs.hashValue
76+
switch rhs {
77+
case .Some(let x):
78+
return x == lhs
79+
case .Any:
80+
return false
81+
}
7282
}
7383

7484
// MARK: NoEvent

0 commit comments

Comments
 (0)