Skip to content

Commit

Permalink
Merge pull request #10 from RxSwiftCommunity/mt/swift4
Browse files Browse the repository at this point in the history
Mt/swift4
  • Loading branch information
icanzilb authored Sep 26, 2017
2 parents b744a74 + 761d7b7 commit beacaa6
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 305 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0
1 change: 1 addition & 0 deletions Example/.swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0
19 changes: 14 additions & 5 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use_frameworks!

abstract_target 'Demo' do
pod 'RealmSwift', '~> 2.1'
pod 'RxSwift', '~> 3.1'
pod 'RxCocoa', '~> 3.1'
pod 'RxRealm', '~> 0.5'
pod 'RealmSwift', '3.0.0-beta.4'
pod 'RxSwift', '4.0.0-beta.0'
pod 'RxCocoa', '4.0.0-beta.0'
pod 'RxRealm', '0.7.1'
pod 'RxRealmDataSources', :path => '../'

target 'RxRealmDataSources_Example' do
Expand All @@ -14,6 +14,15 @@ abstract_target 'Demo' do
target 'RxRealmDataSources_MacExample' do
platform :osx, '10.12'
end
end

# for the transitional period to swift4
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
next unless target.name.include?("RxRealmData")

target 'RxRealmDataSources_Tests'
config.build_settings['SWIFT_VERSION'] = '4.0'
end
end
end
261 changes: 36 additions & 225 deletions Example/RxRealmDataSources.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
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">
<Testables>
<TestableReference
Expand Down Expand Up @@ -69,6 +70,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
3 changes: 1 addition & 2 deletions Example/RxRealmDataSources/DataRandomizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import Foundation
import Dispatch
import RealmSwift
import RxSwift

Expand Down Expand Up @@ -72,7 +71,7 @@ class DataRandomizer {
try! realm.write {
let timerLaps = realm.objects(Timer.self).first!.laps
let index = timerLaps.count.random()
timerLaps.remove(objectAtIndex: index)
timerLaps.remove(at: index)
print("delete from [\(index)]")
}
}
Expand Down
2 changes: 1 addition & 1 deletion Example/RxRealmDataSources/Lap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ import Foundation
import RealmSwift

class Lap: Object {
dynamic var text = Date().description
@objc dynamic var text = Date().description
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ extension MenuViewController: NSTableViewDataSource {

extension MenuViewController: NSTableViewDelegate {
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
let cell = tableView.make(withIdentifier: "MenuCell", owner: self) as! NSTableCellView
let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "MenuCell"), owner: self) as! NSTableCellView
cell.textField?.stringValue = menuItems[row]
return cell
}

func tableViewSelectionDidChange(_ notification: Notification) {
if tableView.selectedRow > -1 {
if let split = parent as? NSSplitViewController, split.childViewControllers.count > 1,
let targetVC = storyboard?.instantiateController(withIdentifier: targetNames[tableView.selectedRow]) as? NSViewController {
let targetVC = storyboard?.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: targetNames[tableView.selectedRow])) as? NSViewController {

split.childViewControllers.replaceSubrange(1...1, with: [targetVC])
}
Expand Down
24 changes: 0 additions & 24 deletions Example/Tests/Info.plist

This file was deleted.

28 changes: 0 additions & 28 deletions Example/Tests/Tests.swift

This file was deleted.

8 changes: 4 additions & 4 deletions Pod/Classes/Reactive+RxRealmDataSources.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import UIKit
extension Reactive where Base: UITableView {

public func realmChanges<E>(_ dataSource: RxTableViewRealmDataSource<E>)
-> RealmBindObserver<E, AnyRealmCollection<E>, RxTableViewRealmDataSource<E>> where E: Object {
-> RealmBindObserver<E, AnyRealmCollection<E>, RxTableViewRealmDataSource<E>> {

return RealmBindObserver(dataSource: dataSource) {ds, results, changes in
if ds.tableView == nil {
Expand Down Expand Up @@ -48,7 +48,7 @@ extension Reactive where Base: UITableView {
extension Reactive where Base: UICollectionView {

public func realmChanges<E>(_ dataSource: RxCollectionViewRealmDataSource<E>)
-> RealmBindObserver<E, AnyRealmCollection<E>, RxCollectionViewRealmDataSource<E>> where E: Object {
-> RealmBindObserver<E, AnyRealmCollection<E>, RxCollectionViewRealmDataSource<E>> {

return RealmBindObserver(dataSource: dataSource) {ds, results, changes in
if ds.collectionView == nil {
Expand Down Expand Up @@ -81,7 +81,7 @@ import Cocoa
extension Reactive where Base: NSTableView {

public func realmChanges<E>(_ dataSource: RxTableViewRealmDataSource<E>)
-> RealmBindObserver<E, AnyRealmCollection<E>, RxTableViewRealmDataSource<E>> where E: Object {
-> RealmBindObserver<E, AnyRealmCollection<E>, RxTableViewRealmDataSource<E>> {

base.delegate = dataSource
base.dataSource = dataSource
Expand All @@ -98,7 +98,7 @@ extension Reactive where Base: NSTableView {
extension Reactive where Base: NSCollectionView {

public func realmChanges<E>(_ dataSource: RxCollectionViewRealmDataSource<E>)
-> RealmBindObserver<E, AnyRealmCollection<E>, RxCollectionViewRealmDataSource<E>> where E: Object {
-> RealmBindObserver<E, AnyRealmCollection<E>, RxCollectionViewRealmDataSource<E>> {

return RealmBindObserver(dataSource: dataSource) {ds, results, changes in
if ds.collectionView == nil {
Expand Down
4 changes: 2 additions & 2 deletions Pod/Classes/RxCollectionViewRealmDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ import Cocoa

public init<ItemType>(itemIdentifier: String, itemType: ItemType.Type, itemConfig: @escaping CollectionItemConfig<E, ItemType>) where ItemType: NSCollectionViewItem {
self.itemIdentifier = itemIdentifier
self.itemFactory = {ds, cv, ip, model in
let item = cv.makeItem(withIdentifier: itemIdentifier, for: ip) as! ItemType
self.itemFactory = { ds, cv, ip, model in
let item = cv.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: itemIdentifier), for: ip) as! ItemType
itemConfig(item, ip, model)
return item
}
Expand Down
10 changes: 5 additions & 5 deletions Pod/Classes/RxTableViewRealmDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ import RxRealm
public var tableView: NSTableView?
public var animated = true
public var rowAnimations = (
insert: NSTableViewAnimationOptions.effectFade,
update: NSTableViewAnimationOptions.effectFade,
delete: NSTableViewAnimationOptions.effectFade)
insert: NSTableView.AnimationOptions.effectFade,
update: NSTableView.AnimationOptions.effectFade,
delete: NSTableView.AnimationOptions.effectFade)

public weak var delegate: NSTableViewDelegate?
public weak var dataSource: NSTableViewDataSource?
Expand All @@ -151,8 +151,8 @@ import RxRealm

public init<CellType>(cellIdentifier: String, cellType: CellType.Type, cellConfig: @escaping TableCellConfig<E, CellType>) where CellType: NSTableCellView {
self.cellIdentifier = cellIdentifier
self.cellFactory = {ds, tv, row, model in
let cell = tv.make(withIdentifier: cellIdentifier, owner: tv) as! CellType
self.cellFactory = { ds, tv, row, model in
let cell = tv.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: cellIdentifier), owner: tv) as! CellType
cellConfig(cell, row, model)
return cell
}
Expand Down
12 changes: 6 additions & 6 deletions RxRealmDataSources.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'RxRealmDataSources'
s.version = '0.2.4'
s.version = '0.2.8'
s.summary = 'Rx data sources for RxRealm`s observable types'

s.description = <<-DESC
Expand All @@ -16,15 +16,15 @@ Pod::Spec.new do |s|

s.requires_arc = true

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.12'

s.source_files = 'Pod/Classes/*.swift'

s.frameworks = 'Foundation'

s.dependency 'RealmSwift', '~> 2.1'
s.dependency 'RxSwift', '~> 3.1'
s.dependency 'RxCocoa', '~> 3.1'
s.dependency 'RxRealm', '~> 0.6'
s.dependency 'RealmSwift', '3.0.0-beta.4'
s.dependency 'RxSwift', '4.0.0-beta.0'
s.dependency 'RxCocoa', '4.0.0-beta.0'
s.dependency 'RxRealm', '0.7.1'
end

0 comments on commit beacaa6

Please sign in to comment.