Skip to content

Commit

Permalink
Swift 4.1 migration (#590)
Browse files Browse the repository at this point in the history
* Updated Result to Swift 4.1

* Swift 4.1: dealt with deprecations of UnsafeMutablePointer and os_unfair_lock_t

Note: not 100% sure this is the right change.

* Swift 4.1: using Expectation.to(equal()) in SignalProducerSpec to deal with regression

See https://twitter.com/NachoSoto/status/954474333669179392.
It lead to an "expression too complex to be solved..." error in `Swift 4.1`.

* Swift 4.1: removed Swift 4.0.x workarounds in UnidirectionalBinding

This seems fixed in `Swift 4.1`.

* Swift 4.1: flatMap -> compactMap

* Using Result.init instead of Result.materialize extension

* Swift 4.1: ReversedRandomAccessCollection -> ReversedCollection

* Swift 4.1: making Signal.Event and ActionError Equatable

* Swift 4.1 regression workaround for Signal.logEvents

See https://bugs.swift.org/browse/SR-6796 and apple/swift#14477.

* SignalProducerLiftingSpec: String.characters is deprecated in Swift 4.1

* Added back in swift 4.0 compatibility.  (#603)

* Added back in swift 4.0 compatibility...

* private vs internal fix.

* Changing Indents.
Added BasePropertyProtocol

* suppressed a swiftlint warning in PostNotifation.swift
Renamed new protocol to _BasePropertyProtocol, and fixed the docstring
removed FIXIT

* .travis.yml: changed image to xcode9.3

* Mitigate a compiler regression in expression resolution.

* Revert changes to the PropertyProtocol to maintain source compatibility.

* Rename a `logIfNeeded` overload which causes infinite recursion with Swift 4.0.

* Update the changelog.

* Indentation fix.

* Add Xcode 9.3 file

* Update Result

* Update Quick and Nimble

* Update xcconfigs

* Remove unused capture

* Remove redundant constraint

* All IndexDistances are Ints now

* String.characters is gone

* Specify 4.1 for the Swift version

* Drop support for Swift 4.0.x
  • Loading branch information
NachoSoto authored and andersio committed May 14, 2018
1 parent 34a7750 commit 344ed7b
Show file tree
Hide file tree
Showing 25 changed files with 146 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .swift-version
@@ -1 +1 @@
4.0.3
4.1
6 changes: 3 additions & 3 deletions .travis.yml
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode9.2
osx_image: xcode9.3
before_install: true
install: true
branches:
Expand All @@ -15,7 +15,7 @@ cache:

jobs:
include:
- osx_image: xcode9.2
- osx_image: xcode9.3
script:
- XCODE_SCHEME=ReactiveSwift-macOS
XCODE_SDK=macosx
Expand All @@ -42,7 +42,7 @@ jobs:
- pod lib lint ReactiveSwift.podspec
env:
- JOB=PODSPEC
- osx_image: xcode9.2
- osx_image: xcode9.3
script:
- swift --version
- swift build
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,9 @@
# master

*Please add new entries at the top.*

1. For Swift 4.1 and above, `BindingSource` conformances are required to have `Error` parameterized as exactly `NoError`. As a result, `Signal` and `SignalProducer` are now conditionally `BindingSource`. (#590, kudos to @NachoSoto and @andersio)
1. For Swift 4.1 and above, `Signal.Event` and `ActionError` are now conditionally `Equatable`. (#590, kudos to @NachoSoto and @andersio)
1. New method `collect(every:on:skipEmpty:discardWhenCompleted:)` which delivers all values that occurred during a time interval (#619, kudos to @Qata)
1. `debounce` now offers an opt-in behaviour to preserve the pending value when the signal or producer completes. You may enable it by specifying `discardWhenCompleted` as false (#287, kudos to @Qata)
1. Result now interoperates with SignalProducer n-ary operators as a constant producer (#606, kudos to @Qata)
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
@@ -1 +1 @@
github "antitypical/Result" ~> 3.2.1
github "antitypical/Result" ~> 4.0
2 changes: 1 addition & 1 deletion Cartfile.private
@@ -1,3 +1,3 @@
github "jspahrsummers/xcconfigs" "3d9d996"
github "jspahrsummers/xcconfigs" == 0.12
github "Quick/Quick" ~> 1.2
github "Quick/Nimble" ~> 7.0.3
8 changes: 4 additions & 4 deletions Cartfile.resolved
@@ -1,4 +1,4 @@
github "Quick/Nimble" "v7.0.3"
github "Quick/Quick" "v1.2.0"
github "antitypical/Result" "3.2.4"
github "jspahrsummers/xcconfigs" "3d9d99634cae6d586e272543d527681283b33eb0"
github "Quick/Nimble" "v7.1.1"
github "Quick/Quick" "v1.3.0"
github "antitypical/Result" "4.0.0"
github "jspahrsummers/xcconfigs" "0.12"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
Submodule Quick updated 44 files
+2 −2 .gitignore
+4 −5 .travis.yml
+1 −0 Documentation/README.md
+2 −2 Documentation/en-us/ConfiguringQuick.md
+14 −14 Documentation/en-us/NimbleAssertions.md
+1 −1 Documentation/en-us/QuickExamplesAndGroups.md
+75 −0 Documentation/en-us/TestingApps.md
+14 −14 Documentation/ja/NimbleAssertions.md
+1 −1 Documentation/ja/QuickExamplesAndGroups.md
+203 −0 Documentation/ko-kr/ArrangeActAssert.md
+80 −0 Documentation/ko-kr/BehavioralTesting.md
+99 −0 Documentation/ko-kr/ConfiguringQuick.md
+25 −0 Documentation/ko-kr/InstallingFileTemplates.md
+141 −0 Documentation/ko-kr/InstallingQuick.md
+25 −0 Documentation/ko-kr/MoreResources.md
+97 −0 Documentation/ko-kr/NimbleAssertions.md
+462 −0 Documentation/ko-kr/QuickExamplesAndGroups.md
+49 −0 Documentation/ko-kr/QuickInObjectiveC.md
+35 −0 Documentation/ko-kr/README.md
+80 −0 Documentation/ko-kr/SettingUpYourXcodeProject.md
+116 −0 Documentation/ko-kr/SharedExamples.md
+129 −0 Documentation/ko-kr/TestUsingTestDoubles.md
+173 −0 Documentation/ko-kr/TestingApps.md
+10 −0 Documentation/ko-kr/Troubleshooting.md
+12 −12 Documentation/zh-cn/NimbleAssertions.md
+1 −1 Documentation/zh-cn/QuickExamplesAndGroups.md
+1 −1 Externals/Nimble
+1 −1 Gemfile
+40 −36 Gemfile.lock
+16 −0 Package.resolved
+1 −1 Quick.podspec
+14 −1 Quick.xcodeproj/project.pbxproj
+1 −3 Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme
+1 −3 Quick.xcodeproj/xcshareddata/xcschemes/Quick-macOS.xcscheme
+1 −3 Quick.xcodeproj/xcshareddata/xcschemes/Quick-tvOS.xcscheme
+8 −0 Quick.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+3 −3 Sources/Quick/Configuration/QuickConfiguration.swift
+14 −2 Sources/Quick/QuickSpec.swift
+4 −0 Sources/QuickObjectiveC/DSL/World+DSL.h
+6 −0 Sources/QuickObjectiveC/QuickSpec.h
+8 −0 Sources/QuickObjectiveC/QuickSpec.m
+4 −0 Sources/QuickObjectiveC/World.h
+4 −0 Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m
+25 −0 Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift
2 changes: 1 addition & 1 deletion Carthage/Checkouts/xcconfigs
20 changes: 10 additions & 10 deletions ReactiveSwift.xcodeproj/project.pbxproj
Expand Up @@ -19,10 +19,6 @@
4A0E11041D2A95200065D310 /* LifetimeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A0E11031D2A95200065D310 /* LifetimeSpec.swift */; };
4A0E11051D2A95200065D310 /* LifetimeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A0E11031D2A95200065D310 /* LifetimeSpec.swift */; };
4A0E11061D2A95200065D310 /* LifetimeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A0E11031D2A95200065D310 /* LifetimeSpec.swift */; };
4AC73ECB1DF273570004EC4F /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AC73ECA1DF273570004EC4F /* ResultExtensions.swift */; };
4AC73ECC1DF273570004EC4F /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AC73ECA1DF273570004EC4F /* ResultExtensions.swift */; };
4AC73ECD1DF273570004EC4F /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AC73ECA1DF273570004EC4F /* ResultExtensions.swift */; };
4AC73ECE1DF273570004EC4F /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AC73ECA1DF273570004EC4F /* ResultExtensions.swift */; };
579504331BB8A34200A5E482 /* BagSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C312EF19EF2A7700984962 /* BagSpec.swift */; };
579504341BB8A34300A5E482 /* BagSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C312EF19EF2A7700984962 /* BagSpec.swift */; };
57A4D1B11BA13D7A00F7D4B1 /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = D871D69E1B3B29A40070F16C /* Optional.swift */; };
Expand Down Expand Up @@ -65,6 +61,10 @@
9A1A4F9D1E16AE50006F3039 /* ValidatingPropertySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1A4F981E16961C006F3039 /* ValidatingPropertySpec.swift */; };
9A1A4F9E1E16AE50006F3039 /* ValidatingPropertySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1A4F981E16961C006F3039 /* ValidatingPropertySpec.swift */; };
9A1A4F9F1E16AE55006F3039 /* ValidatingPropertySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1A4F981E16961C006F3039 /* ValidatingPropertySpec.swift */; };
9A1B824120835EEC00EB7C09 /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B824020835EEC00EB7C09 /* ResultExtensions.swift */; };
9A1B824220835EEC00EB7C09 /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B824020835EEC00EB7C09 /* ResultExtensions.swift */; };
9A1B824320835EEC00EB7C09 /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B824020835EEC00EB7C09 /* ResultExtensions.swift */; };
9A1B824420835EEC00EB7C09 /* ResultExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B824020835EEC00EB7C09 /* ResultExtensions.swift */; };
9A1D067D1D948A2300ACF44C /* UnidirectionalBindingSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1D067C1D948A2200ACF44C /* UnidirectionalBindingSpec.swift */; };
9A1D067E1D948A2300ACF44C /* UnidirectionalBindingSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1D067C1D948A2200ACF44C /* UnidirectionalBindingSpec.swift */; };
9A1D067F1D948A2300ACF44C /* UnidirectionalBindingSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1D067C1D948A2200ACF44C /* UnidirectionalBindingSpec.swift */; };
Expand Down Expand Up @@ -239,7 +239,6 @@
4A0AB6711DC28EFF00AA1E81 /* ReactiveExtensionsSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReactiveExtensionsSpec.swift; sourceTree = "<group>"; };
4A0E10FE1D2A92720065D310 /* Lifetime.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Lifetime.swift; sourceTree = "<group>"; };
4A0E11031D2A95200065D310 /* LifetimeSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LifetimeSpec.swift; sourceTree = "<group>"; };
4AC73ECA1DF273570004EC4F /* ResultExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultExtensions.swift; sourceTree = "<group>"; };
57A4D2411BA13D7A00F7D4B1 /* ReactiveSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReactiveSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
57A4D2441BA13F9700F7D4B1 /* tvOS-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "tvOS-Application.xcconfig"; sourceTree = "<group>"; };
57A4D2451BA13F9700F7D4B1 /* tvOS-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "tvOS-Base.xcconfig"; sourceTree = "<group>"; };
Expand All @@ -248,6 +247,7 @@
7DFBED031CDB8C9500EE435B /* ReactiveSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactiveSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
9A090C131DA0309E00EE97CA /* Reactive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reactive.swift; sourceTree = "<group>"; };
9A1A4F981E16961C006F3039 /* ValidatingPropertySpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidatingPropertySpec.swift; sourceTree = "<group>"; };
9A1B824020835EEC00EB7C09 /* ResultExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultExtensions.swift; sourceTree = "<group>"; };
9A1D067C1D948A2200ACF44C /* UnidirectionalBindingSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnidirectionalBindingSpec.swift; sourceTree = "<group>"; };
9A67963A1F6056B90058C5B4 /* UninhabitedTypeGuards.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UninhabitedTypeGuards.swift; sourceTree = "<group>"; };
9A681A9D1E5A241B00B097CF /* DeprecationSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeprecationSpec.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -425,7 +425,7 @@
D03B4A3B19F4C281009E02AC /* Extensions */ = {
isa = PBXGroup;
children = (
4AC73ECA1DF273570004EC4F /* ResultExtensions.swift */,
9A1B824020835EEC00EB7C09 /* ResultExtensions.swift */,
D03B4A3C19F4C39A009E02AC /* FoundationExtensions.swift */,
);
name = Extensions;
Expand Down Expand Up @@ -883,7 +883,6 @@
57A4D1B41BA13D7A00F7D4B1 /* Disposable.swift in Sources */,
57A4D1B61BA13D7A00F7D4B1 /* Event.swift in Sources */,
57A4D1B81BA13D7A00F7D4B1 /* Scheduler.swift in Sources */,
4AC73ECE1DF273570004EC4F /* ResultExtensions.swift in Sources */,
9A9100E21E0E6E680093E346 /* ValidatingProperty.swift in Sources */,
57A4D1B91BA13D7A00F7D4B1 /* Action.swift in Sources */,
57A4D1BA1BA13D7A00F7D4B1 /* Property.swift in Sources */,
Expand All @@ -893,6 +892,7 @@
57A4D1BC1BA13D7A00F7D4B1 /* SignalProducer.swift in Sources */,
57A4D1BD1BA13D7A00F7D4B1 /* Atomic.swift in Sources */,
57A4D1BE1BA13D7A00F7D4B1 /* Bag.swift in Sources */,
9A1B824420835EEC00EB7C09 /* ResultExtensions.swift in Sources */,
57A4D1C01BA13D7A00F7D4B1 /* FoundationExtensions.swift in Sources */,
D85C652D1C0E70E5005A77AD /* Flatten.swift in Sources */,
9ABCB1881D2A5B5A00BCA243 /* Deprecations+Removals.swift in Sources */,
Expand Down Expand Up @@ -938,7 +938,6 @@
A9B315BC1B3940810001CB9C /* Disposable.swift in Sources */,
A9B315BE1B3940810001CB9C /* Event.swift in Sources */,
A9B315C01B3940810001CB9C /* Scheduler.swift in Sources */,
4AC73ECD1DF273570004EC4F /* ResultExtensions.swift in Sources */,
9A9100E11E0E6E680093E346 /* ValidatingProperty.swift in Sources */,
A9B315C11B3940810001CB9C /* Action.swift in Sources */,
A9B315C21B3940810001CB9C /* Property.swift in Sources */,
Expand All @@ -948,6 +947,7 @@
A9B315C41B3940810001CB9C /* SignalProducer.swift in Sources */,
A9B315C51B3940810001CB9C /* Atomic.swift in Sources */,
A9B315C61B3940810001CB9C /* Bag.swift in Sources */,
9A1B824320835EEC00EB7C09 /* ResultExtensions.swift in Sources */,
A9B315C81B3940810001CB9C /* FoundationExtensions.swift in Sources */,
D85C652C1C0E70E4005A77AD /* Flatten.swift in Sources */,
9ABCB1871D2A5B5A00BCA243 /* Deprecations+Removals.swift in Sources */,
Expand All @@ -965,7 +965,6 @@
D871D69F1B3B29A40070F16C /* Optional.swift in Sources */,
D08C54B61A69A3DB00AD8286 /* Event.swift in Sources */,
D0C312D319EF2A5800984962 /* Disposable.swift in Sources */,
4AC73ECB1DF273570004EC4F /* ResultExtensions.swift in Sources */,
9A9100DF1E0E6E620093E346 /* ValidatingProperty.swift in Sources */,
EBCC7DBC1BBF010C00A2AE92 /* Observer.swift in Sources */,
D03B4A3D19F4C39A009E02AC /* FoundationExtensions.swift in Sources */,
Expand All @@ -976,6 +975,7 @@
D0C312CF19EF2A5800984962 /* Bag.swift in Sources */,
4A0E10FF1D2A92720065D310 /* Lifetime.swift in Sources */,
D0C312E719EF2A5800984962 /* Scheduler.swift in Sources */,
9A1B824120835EEC00EB7C09 /* ResultExtensions.swift in Sources */,
D0C312CD19EF2A5800984962 /* Atomic.swift in Sources */,
D08C54BA1A69C54300AD8286 /* Property.swift in Sources */,
D0D11AB91A6AE87700C1F8B1 /* Action.swift in Sources */,
Expand Down Expand Up @@ -1021,7 +1021,6 @@
D8E84A671B3B32FB00C3E831 /* Optional.swift in Sources */,
D0C312D419EF2A5800984962 /* Disposable.swift in Sources */,
D08C54B91A69A9D100AD8286 /* SignalProducer.swift in Sources */,
4AC73ECC1DF273570004EC4F /* ResultExtensions.swift in Sources */,
9A9100E01E0E6E670093E346 /* ValidatingProperty.swift in Sources */,
9ABCB1861D2A5B5A00BCA243 /* Deprecations+Removals.swift in Sources */,
EBCC7DBD1BBF01E100A2AE92 /* Observer.swift in Sources */,
Expand All @@ -1031,6 +1030,7 @@
4A0E11001D2A92720065D310 /* Lifetime.swift in Sources */,
D08C54BB1A69C54400AD8286 /* Property.swift in Sources */,
D03B4A3E19F4C39A009E02AC /* FoundationExtensions.swift in Sources */,
9A1B824220835EEC00EB7C09 /* ResultExtensions.swift in Sources */,
D08C54B71A69A3DB00AD8286 /* Event.swift in Sources */,
C79B647D1CD52E4A003F2376 /* EventLogger.swift in Sources */,
D0C312CE19EF2A5800984962 /* Atomic.swift in Sources */,
Expand Down
@@ -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>
3 changes: 3 additions & 0 deletions Sources/Action.swift
Expand Up @@ -334,3 +334,6 @@ extension ActionError where Error: Equatable {
}
}
}

extension ActionError: Equatable where Error: Equatable {}

16 changes: 8 additions & 8 deletions Sources/Atomic.swift
Expand Up @@ -30,8 +30,8 @@ internal struct UnsafeAtomicState<State: RawRepresentable> where State.RawValue

/// Deinitialize the finite state machine.
internal func deinitialize() {
value.deinitialize()
value.deallocate(capacity: 1)
value.deinitialize(count: 1)
value.deallocate()
}

/// Compare the current state with the specified state.
Expand Down Expand Up @@ -132,8 +132,8 @@ internal class Lock {
}

deinit {
_lock.deinitialize()
_lock.deallocate(capacity: 1)
_lock.deinitialize(count: 1)
_lock.deallocate()
}
}
#endif
Expand All @@ -151,8 +151,8 @@ internal class Lock {

defer {
pthread_mutexattr_destroy(attr)
attr.deinitialize()
attr.deallocate(capacity: 1)
attr.deinitialize(count: 1)
attr.deallocate()
}

// Darwin pthread for 32-bit ARM somehow returns `EAGAIN` when
Expand Down Expand Up @@ -196,8 +196,8 @@ internal class Lock {
let status = pthread_mutex_destroy(_lock)
assert(status == 0, "Unexpected pthread mutex error code: \(status)")

_lock.deinitialize()
_lock.deallocate(capacity: 1)
_lock.deinitialize(count: 1)
_lock.deallocate()
}
}

Expand Down
6 changes: 4 additions & 2 deletions Sources/Disposable.swift
Expand Up @@ -149,8 +149,10 @@ public final class CompositeDisposable: Disposable {
/// - parameters:
/// - disposables: A collection of objects conforming to the `Disposable`
/// protocol
public convenience init<S: Sequence>(_ disposables: S) where S.Iterator.Element == Disposable? {
self.init(disposables.flatMap { $0 })
public convenience init<S: Sequence>(_ disposables: S)
where S.Iterator.Element == Disposable?
{
self.init(disposables.compactMap { $0 })
}

/// Initializes an empty `CompositeDisposable`.
Expand Down
6 changes: 4 additions & 2 deletions Sources/Event.swift
Expand Up @@ -140,6 +140,8 @@ extension Signal.Event where Value: Equatable, Error: Equatable {
}
}

extension Signal.Event: Equatable where Value: Equatable, Error: Equatable {}

extension Signal.Event: CustomStringConvertible {
public var description: String {
switch self {
Expand Down Expand Up @@ -348,7 +350,7 @@ extension Signal.Event where Error == AnyError {

internal static func attemptMap<U>(_ transform: @escaping (Value) throws -> U) -> Transformation<U, AnyError> {
return attemptMap { value in
ReactiveSwift.materialize { try transform(value) }
Result { try transform(value) }
}
}
}
Expand Down Expand Up @@ -882,7 +884,7 @@ extension Signal.Event {
let state = Atomic<CollectEveryState<Value>>(.init(skipEmpty: skipEmpty))
let d = SerialDisposable()

d.inner = scheduler.schedule(after: scheduler.currentDate.addingTimeInterval(interval), interval: interval, leeway: interval * 0.1) { [weak d] in
d.inner = scheduler.schedule(after: scheduler.currentDate.addingTimeInterval(interval), interval: interval, leeway: interval * 0.1) {
let (currentValues, isCompleted) = state.modify { ($0.collect(), $0.isCompleted) }
if let currentValues = currentValues {
action(.value(currentValues))
Expand Down

0 comments on commit 344ed7b

Please sign in to comment.