Skip to content

Commit

Permalink
Merge pull request #15 from Fueled/reactive-swift-update
Browse files Browse the repository at this point in the history
Reactive swift update
  • Loading branch information
leonty-fueled authored Nov 23, 2017
2 parents d278d46 + a7528e2 commit 82f5b8b
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "Carthage/Checkouts/Result"]
path = Carthage/Checkouts/Result
url = ssh://git@github.com/antitypical/Result.git
url = https://github.com/antitypical/Result.git
[submodule "Carthage/Checkouts/ReactiveCocoa"]
path = Carthage/Checkouts/ReactiveCocoa
url = ssh://git@github.com/ReactiveCocoa/ReactiveCocoa.git
url = https://github.com/ReactiveCocoa/ReactiveCocoa.git
[submodule "Carthage/Checkouts/ReactiveSwift"]
path = Carthage/Checkouts/ReactiveSwift
url = ssh://git@github.com/ReactiveCocoa/ReactiveSwift.git
url = https://github.com/ReactiveCocoa/ReactiveSwift.git
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveCocoa/ReactiveCocoa"
github "ReactiveCocoa/ReactiveCocoa" ~> 7.0
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "ReactiveCocoa/ReactiveCocoa" "6.0.1"
github "ReactiveCocoa/ReactiveSwift" "2.0.1"
github "antitypical/Result" "3.2.3"
github "ReactiveCocoa/ReactiveCocoa" "7.0.0"
github "ReactiveCocoa/ReactiveSwift" "3.0.0"
github "antitypical/Result" "3.2.4"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ReactiveCocoa
Submodule ReactiveCocoa updated 60 files
+1 −0 .swift-version
+36 −84 .travis.yml
+38 −0 CHANGELOG.md
+1 −1 Cartfile
+2 −2 Cartfile.private
+4 −4 Cartfile.resolved
+1 −1 Carthage/Checkouts/Nimble
+1 −1 Carthage/Checkouts/Quick
+1 −1 Carthage/Checkouts/ReactiveSwift
+1 −1 Carthage/Checkouts/Result
+4 −9 README.md
+2 −2 ReactiveCocoa.podspec
+545 −53 ReactiveCocoa.xcodeproj/project.pbxproj
+13 −2 ReactiveCocoa.xcodeproj/xcshareddata/xcschemes/ReactiveCocoa-iOS.xcscheme
+13 −2 ReactiveCocoa.xcodeproj/xcshareddata/xcschemes/ReactiveCocoa-macOS.xcscheme
+13 −2 ReactiveCocoa.xcodeproj/xcshareddata/xcschemes/ReactiveCocoa-tvOS.xcscheme
+101 −0 ReactiveCocoa.xcodeproj/xcshareddata/xcschemes/ReactiveMapKit.xcscheme
+1 −1 ReactiveCocoa/AppKit/ActionProxy.swift
+12 −0 ReactiveCocoa/AppKit/NSButton.swift
+8 −0 ReactiveCocoa/AppKit/NSControl.swift
+7 −1 ReactiveCocoa/AppKit/NSTextField.swift
+2 −2 ReactiveCocoa/DelegateProxy.swift
+26 −32 ReactiveCocoa/DynamicProperty.swift
+1 −1 ReactiveCocoa/Info.plist
+26 −0 ReactiveCocoa/NSObject+BindingTarget.swift
+12 −9 ReactiveCocoa/NSObject+Intercepting.swift
+43 −5 ReactiveCocoa/NSObject+KeyValueObserving.swift
+8 −4 ReactiveCocoa/NSObject+Lifetime.swift
+1 −1 ReactiveCocoa/NSObject+Synchronizing.swift
+7 −5 ReactiveCocoa/ObjC+Runtime.swift
+1 −1 ReactiveCocoa/ObjC+RuntimeSubclassing.swift
+2 −2 ReactiveCocoa/UIKit/UIControl.swift
+2 −2 ReactiveCocoa/UIKit/UIGestureRecognizer.swift
+5 −0 ReactiveCocoa/UIKit/UITextField.swift
+52 −2 ReactiveCocoa/UIKit/iOS/UISearchBar.swift
+5 −5 ReactiveCocoaTests/AppKit/ActionProxySpec.swift
+20 −20 ReactiveCocoaTests/AppKit/NSButtonSpec.swift
+5 −1 ReactiveCocoaTests/AppKit/NSControlSpec.swift
+4 −0 ReactiveCocoaTests/AppKit/NSImageViewSpec.swift
+13 −0 ReactiveCocoaTests/AppKit/Swift4TestInteroperability.swift
+47 −0 ReactiveCocoaTests/BindingTargetSpec.swift
+3 −3 ReactiveCocoaTests/DelegateProxySpec.swift
+1 −1 ReactiveCocoaTests/DeprecationsSpec.swift
+33 −16 ReactiveCocoaTests/DynamicPropertySpec.swift
+1 −1 ReactiveCocoaTests/Info.plist
+6 −6 ReactiveCocoaTests/InterceptingPerformanceTests.swift
+16 −16 ReactiveCocoaTests/InterceptingSpec.swift
+192 −0 ReactiveCocoaTests/KVOKVCExtensionSpec.swift
+6 −6 ReactiveCocoaTests/KeyValueObservingSpec.swift
+5 −5 ReactiveCocoaTests/UIKit/UIControl+EnableSendActionsForControlEvents.swift
+113 −27 ReactiveCocoaTests/UIKit/UISearchBarSpec.swift
+15 −1 ReactiveCocoaTests/UIKit/UITextFieldSpec.swift
+8 −0 ReactiveCocoaTests/UIKit/UITextViewSpec.swift
+23 −0 ReactiveMapKit.podspec
+24 −0 ReactiveMapKit/Info.plist
+3 −0 ReactiveMapKit/MKMapView.swift
+22 −0 ReactiveMapKitTests/Info.plist
+1 −0 ReactiveMapKitTests/MKMapViewSpec.swift
+5 −9 script/build
+1 −1 script/update-version
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ReactiveSwift
Submodule ReactiveSwift updated 48 files
+1 −0 .gitignore
+1 −1 .swift-version
+29 −99 .travis.yml
+38 −0 CHANGELOG.md
+2 −2 Cartfile.private
+3 −3 Cartfile.resolved
+1 −1 Carthage/Checkouts/Nimble
+1 −1 Carthage/Checkouts/Quick
+1 −1 Carthage/Checkouts/Result
+2 −4 Documentation/APIContracts.md
+1 −1 Documentation/FrameworkOverview.md
+3 −3 Package.pins
+4 −2 Package.swift
+13 −17 README.md
+1 −0 ReactiveSwift-UIExamples.playground/Pages/ValidatingProperty.xcplaygroundpage/Sources/FormView.swift
+1 −1 ReactiveSwift.podspec
+21 −22 ReactiveSwift.xcodeproj/project.pbxproj
+2 −0 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-iOS.xcscheme
+2 −0 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-macOS.xcscheme
+2 −0 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-tvOS.xcscheme
+4 −1 ReactiveSwift.xcodeproj/xcshareddata/xcschemes/ReactiveSwift-watchOS.xcscheme
+2 −3 Sources/Action.swift
+5 −5 Sources/Atomic.swift
+1 −1 Sources/Bag.swift
+6 −187 Sources/Deprecations+Removals.swift
+26 −1 Sources/Disposable.swift
+551 −7 Sources/Event.swift
+18 −34 Sources/Flatten.swift
+38 −68 Sources/FoundationExtensions.swift
+1 −1 Sources/Info.plist
+4 −3 Sources/Lifetime.swift
+60 −9 Sources/Observer.swift
+42 −53 Sources/Property.swift
+8 −0 Sources/Scheduler.swift
+115 −526 Sources/Signal.swift
+306 −157 Sources/SignalProducer.swift
+5 −5 Sources/UnidirectionalBinding.swift
+42 −42 Sources/UninhabitedTypeGuards.swift
+9 −6 Tests/ReactiveSwiftTests/FoundationExtensionsSpec.swift
+1 −1 Tests/ReactiveSwiftTests/Info.plist
+4 −2 Tests/ReactiveSwiftTests/PropertySpec.swift
+51 −32 Tests/ReactiveSwiftTests/SignalLifetimeSpec.swift
+3 −0 Tests/ReactiveSwiftTests/SignalProducerLiftingSpec.swift
+3 −3 Tests/ReactiveSwiftTests/SignalProducerNimbleMatchers.swift
+29 −0 Tests/ReactiveSwiftTests/SignalProducerSpec.swift
+22 −31 Tests/ReactiveSwiftTests/SignalSpec.swift
+0 −2 Tests/ReactiveSwiftTests/UnidirectionalBindingSpec.swift
+5 −9 script/build
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Result
15 changes: 7 additions & 8 deletions FueledUtils/DecoratingTextFieldDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,15 @@ public final class DecoratingTextFieldDelegate: NSObject {
/// `patternForDataString`.
public func decorateString(_ dataString: String) -> String {
var res = ""
let dataChars = dataString.characters
var dataIndex = dataChars.startIndex
var dataIndex = dataString.startIndex
let pattern = self.patternForDataString(dataString)
for patternChar in pattern.characters {
for patternChar in pattern {
if patternChar == patternPlaceholderForDataCharacter {
if dataIndex == dataChars.endIndex {
if dataIndex == dataString.endIndex {
return res
}
res += String(dataChars[dataIndex])
dataIndex = dataChars.index(after: dataIndex)
res += String(dataString[dataIndex])
dataIndex = dataString.index(after: dataIndex)
} else {
res += String(patternChar)
}
Expand All @@ -84,7 +83,7 @@ public final class DecoratingTextFieldDelegate: NSObject {
/// Strips formatting (decoration) characters from the input string.
public func undecorateString(_ decoratedString: String) -> String {
var res = ""
for decoChar in decoratedString.characters {
for decoChar in decoratedString {
if isDataCharacter(decoChar) {
res += String(decoChar)
}
Expand All @@ -106,7 +105,7 @@ public final class DecoratingTextFieldDelegate: NSObject {
}
var res = 0
var prefixLength = dataLocation
for decoChar in decoratedString.characters {
for decoChar in decoratedString {
let characterLength = String(decoChar).nsLength
if isDataCharacter(decoChar) {
if prefixLength <= 0 {
Expand Down
18 changes: 8 additions & 10 deletions FueledUtils/RACExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public extension SignalProtocol {
will result in all changes to `constraintConstantValue` in `viewModel` to be reflected in the constraint and animated.
*/
public func observe(context: @escaping (@escaping () -> Void) -> Void) -> Signal<Value, Error> {
return Signal { observer in
return self.signal.observe { event in
return Signal { observer, disposable in
disposable += self.signal.observe { event in
switch event {
case .value:
context({ observer.action(event) })
context({ observer.send(event) })
default:
observer.action(event)
observer.send(event)
}
}
}
Expand Down Expand Up @@ -109,14 +109,13 @@ public extension SignalProtocol {
/// `interval` seconds apart.
///
func minimum(interval: TimeInterval, on scheduler: DateScheduler) -> Signal<Value, Error> {
return Signal { observer in
return Signal { observer, disposable in
let semaphore = DispatchSemaphore(value: 1)
var events: [Signal<Value, Error>.Event] = []
var forwardEvents = false
let disposable = CompositeDisposable()
func sendEvents() {
semaphore.wait()
events.forEach { observer.action($0) }
events.forEach { observer.send($0) }
events.removeAll()
forwardEvents = true
semaphore.signal()
Expand All @@ -127,18 +126,17 @@ public extension SignalProtocol {
disposable += self.signal.observe { event in
if case .interrupted = event {
sendEvents()
observer.action(event)
observer.send(event)
return
}
if forwardEvents {
observer.action(event)
observer.send(event)
} else {
semaphore.wait()
events.append(event)
semaphore.signal()
}
}
return disposable
}
}
}
Expand Down
1 change: 1 addition & 0 deletions FueledUtils/SetRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public extension UIApplicationDelegate {
animations: {
UIView.setAnimationsEnabled(false)
window.endEditing(true)

window.rootViewController = viewController
window.layoutIfNeeded()
UIView.setAnimationsEnabled(true)
Expand Down
2 changes: 1 addition & 1 deletion FueledUtils/SignalingAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class SignalingAlert<T> {

public func addAction(title: String, style: UIAlertActionStyle, event: Signal<T, NoError>.Event) {
controller.addAction(UIAlertAction(title: title, style: style) { [observer] _ in
observer.action(event)
observer.send(event)
})
}

Expand Down

0 comments on commit 82f5b8b

Please sign in to comment.