Skip to content

Commit

Permalink
Merge pull request #93 from RxSwiftCommunity/mt/swift4.0
Browse files Browse the repository at this point in the history
swift4.0
  • Loading branch information
icanzilb authored Oct 20, 2017
2 parents 5aadf22 + bef0561 commit 32cdef4
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
3.0
4.0

20 changes: 11 additions & 9 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!

def common
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
pod 'RealmSwift', '~> 3.0'
end

target 'RxRealm_Example' do
platform :ios, '8.0'
platform :ios, '9.0'
common
pod 'RxRealm', :path => '../'
pod 'RxSwift', '~> 3'
pod 'RxCocoa', '~> 3'
pod 'RealmSwift', '~> 2'
end

target 'RxRealm_Tests' do
platform :ios, '8.0'
pod 'RxSwift', '~> 3'
pod 'RxCocoa', '~> 3'
pod 'RxTest', '~> 3'
pod 'RealmSwift', '~> 2'
platform :ios, '9.0'
common
pod 'RxTest', '~> 4.0'
pod 'RxRealm', :path => '../'
end
36 changes: 27 additions & 9 deletions Example/RxRealm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0810;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = 9MF8G8D9Y5;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
9CEB7A461CC834340077C44D = {
CreatedOnToolsVersion = 7.3;
DevelopmentTeam = 9MF8G8D9Y5;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -464,14 +464,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -495,7 +501,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -511,14 +517,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -535,7 +547,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -560,11 +572,13 @@
"$PODS_CONFIGURATION_BUILD_DIR",
);
INFOPLIST_FILE = RxRealm/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -585,11 +599,13 @@
"$PODS_CONFIGURATION_BUILD_DIR",
);
INFOPLIST_FILE = RxRealm/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -606,7 +622,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.rxswiftcommunity.RxRealm-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -622,7 +639,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.rxswiftcommunity.RxRealm-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
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 = "0810"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
Expand Down Expand Up @@ -70,6 +71,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
6 changes: 3 additions & 3 deletions Example/RxRealm/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import RxRealm

//realm model
class Lap: Object {
dynamic var time: TimeInterval = Date().timeIntervalSinceReferenceDate
@objc dynamic var time: TimeInterval = Date().timeIntervalSinceReferenceDate
}

class TickCounter: Object {
dynamic var id = UUID().uuidString
dynamic var ticks: Int = 0
@objc dynamic var id = UUID().uuidString
@objc dynamic var ticks: Int = 0
override static func primaryKey() -> String? { return "id" }
}

Expand Down
4 changes: 2 additions & 2 deletions Example/RxRealm_Tests/RxRealmLinkingObjectsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RxRealmLinkingObjectsTests: XCTestCase {
realm.add(message)
}

let users$ = Observable.collection(from: message.mentions).shareReplay(1)
let users$ = Observable.collection(from: message.mentions).share(replay: 1)
users$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 3 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
users$
Expand Down Expand Up @@ -89,7 +89,7 @@ class RxRealmLinkingObjectsTests: XCTestCase {
realm.add(message)
}

let users$ = Observable.changeset(from: message.mentions).shareReplay(1)
let users$ = Observable.changeset(from: message.mentions).share(replay: 1)
users$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 3 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
users$
Expand Down
4 changes: 2 additions & 2 deletions Example/RxRealm_Tests/RxRealmListTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RxRealmListTests: XCTestCase {
realm.add(message)
}

let users$ = Observable.collection(from: message.recipients).shareReplay(1)
let users$ = Observable.collection(from: message.recipients).share(replay: 1)
users$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 3 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
users$
Expand Down Expand Up @@ -86,7 +86,7 @@ class RxRealmListTests: XCTestCase {
realm.add(message)
}

let users$ = Observable.changeset(from: message.recipients).shareReplay(1)
let users$ = Observable.changeset(from: message.recipients).share(replay: 1)
users$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 3 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
users$
Expand Down
6 changes: 3 additions & 3 deletions Example/RxRealm_Tests/RxRealmObjectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RxRealmObjectTests: XCTestCase {
realm.add(obj)
}

let object$ = Observable<UniqueObject>.from(object: obj).shareReplay(1)
let object$ = Observable<UniqueObject>.from(object: obj).share(replay: 1)
object$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 4 }.map {_ in ()}
.subscribe(onNext: expectation1.fulfill, onError: {error in expectation1.fulfill()})
Expand Down Expand Up @@ -167,7 +167,7 @@ class RxRealmObjectTests: XCTestCase {
realm.add(obj)
}

let object$ = Observable<UniqueObject>.propertyChanges(object: obj).shareReplay(1)
let object$ = Observable<UniqueObject>.propertyChanges(object: obj).share(replay: 1)
object$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 3 }.map {_ in ()}
.subscribe(onNext: expectation1.fulfill, onError: {error in expectation1.fulfill()})
Expand Down Expand Up @@ -231,7 +231,7 @@ class RxRealmObjectTests: XCTestCase {
}

let object$ = Observable<User>.from(object: obj, properties: ["name"])
.shareReplay(1)
.share(replay: 1)

object$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 3 }.map {_ in ()}
Expand Down
4 changes: 2 additions & 2 deletions Example/RxRealm_Tests/RxRealmRealmTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RxRealmRealmTests: XCTestCase {
typealias loggedNotification = (Realm, Realm.Notification)
let observer = scheduler.createObserver(loggedNotification.self)

let realm$ = Observable<(Realm, Realm.Notification)>.from(realm: realm).shareReplay(1)
let realm$ = Observable<(Realm, Realm.Notification)>.from(realm: realm).share(replay: 1)
realm$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 2 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
realm$
Expand Down Expand Up @@ -71,7 +71,7 @@ class RxRealmRealmTests: XCTestCase {
typealias loggedNotification = (Realm, Realm.Notification)
let observer = scheduler.createObserver(loggedNotification.self)

let realm$ = Observable<(Realm, Realm.Notification)>.from(realm: realm).shareReplay(1)
let realm$ = Observable<(Realm, Realm.Notification)>.from(realm: realm).share(replay: 1)
realm$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 1 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
realm$
Expand Down
4 changes: 2 additions & 2 deletions Example/RxRealm_Tests/RxRealmResultsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RxRealmResultsTests: XCTestCase {
let scheduler = TestScheduler(initialClock: 0)
let observer = scheduler.createObserver(Results<Message>.self)

let messages$ = Observable.collection(from: realm.objects(Message.self)).shareReplay(1)
let messages$ = Observable.collection(from: realm.objects(Message.self)).share(replay: 1)
messages$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 4 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
messages$
Expand Down Expand Up @@ -83,7 +83,7 @@ class RxRealmResultsTests: XCTestCase {
let scheduler = TestScheduler(initialClock: 0)
let observer = scheduler.createObserver(String.self)

let messages$ = Observable.changeset(from: realm.objects(Message.self)).shareReplay(1)
let messages$ = Observable.changeset(from: realm.objects(Message.self)).share(replay: 1)
messages$.scan(0, accumulator: {acc, _ in return acc+1})
.filter { $0 == 3 }.map {_ in ()}.subscribe(onNext: expectation1.fulfill).disposed(by: bag)
messages$
Expand Down
8 changes: 4 additions & 4 deletions Example/RxRealm_Tests/RxRealmTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RxRealm_Tests: XCTestCase {
let scheduler = TestScheduler(initialClock: 0)
let observer = scheduler.createObserver(Results<Message>.self)

let messages$ = Observable.collection(from: realm.objects(Message.self)).shareReplay(1)
let messages$ = Observable.collection(from: realm.objects(Message.self)).share(replay: 1)
messages$.subscribe(onNext: {
if $0.count == 2 {
expectation1.fulfill()
Expand Down Expand Up @@ -86,7 +86,7 @@ class RxRealm_Tests: XCTestCase {
let scheduler = TestScheduler(initialClock: 0)
let observer = scheduler.createObserver(Array<Message>.self)

let messages$ = Observable.array(from: realm.objects(Message.self)).shareReplay(1)
let messages$ = Observable.array(from: realm.objects(Message.self)).share(replay: 1)
messages$.subscribe(onNext: {
if $0.count == 2 {
expectation1.fulfill()
Expand Down Expand Up @@ -124,7 +124,7 @@ class RxRealm_Tests: XCTestCase {
//initial data
addMessage(realm, text: "first(Changeset)")

let messages$ = Observable.changeset(from: realm.objects(Message.self)).shareReplay(1)
let messages$ = Observable.changeset(from: realm.objects(Message.self)).share(replay: 1)
messages$.scan(0) { count, _ in
return count+1
}
Expand Down Expand Up @@ -185,7 +185,7 @@ class RxRealm_Tests: XCTestCase {
//initial data
addMessage(realm, text: "first(ArrayChangeset)")

let messages$ = Observable.changeset(from: realm.objects(Message.self)).shareReplay(1)
let messages$ = Observable.changeset(from: realm.objects(Message.self)).share(replay: 1)
messages$.scan(0) { count, _ in
return count+1
}
Expand Down
Loading

0 comments on commit 32cdef4

Please sign in to comment.