Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #56 from 3lvis/update/swift-2-2
Browse files Browse the repository at this point in the history
Update to Swift 2.2
  • Loading branch information
3lvis committed Mar 23, 2016
2 parents 311ea98 + 5f943ab commit 22190b8
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode7.1
osx_image: xcode7.3
language: objective-c
cache: cocoapods
before_install: gem install xcpretty cocoapods obcd slather -N
Expand Down
2 changes: 1 addition & 1 deletion CollectionSwift/CollectionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CollectionController: UICollectionViewController {
collectionView.backgroundColor = UIColor.whiteColor()
collectionView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)

self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "saveAction")
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: #selector(CollectionController.saveAction))
}

func saveAction() {
Expand Down
4 changes: 2 additions & 2 deletions DATASourceDelegateTableSwift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class ViewController: UITableViewController {
super.viewDidLoad()

self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: ViewController.CellIdentifier)
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "saveAction")
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Edit, target: self, action: "editAction")
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: #selector(ViewController.saveAction))
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Edit, target: self, action: #selector(ViewController.editAction))
self.tableView.dataSource = self.dataSource
self.tableView.delegate = self
}
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 = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
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 = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
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 = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
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 = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
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 = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Demo.xcodeproj/xcshareddata/xcschemes/TableObjC.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Demo.xcodeproj/xcshareddata/xcschemes/TableSwift.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Demo.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
14 changes: 7 additions & 7 deletions InfiniteCollectionSwift/CollectionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class CollectionController: UICollectionViewController {
return dataSource
}()

lazy var loadingView: LoadingView = {
let loadingView = LoadingView()
lazy var infiniteLoadingIndicator: InfiniteLoadingIndicator = {
let infiniteLoadingIndicator = InfiniteLoadingIndicator(parentController: self)

return loadingView
return infiniteLoadingIndicator
}()

init(layout: UICollectionViewLayout, dataStack: DATAStack) {
Expand All @@ -50,9 +50,9 @@ class CollectionController: UICollectionViewController {
collectionView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)

if self.dataSource.isEmpty {
self.loadingView.present()
self.infiniteLoadingIndicator.present()
self.loadItems(0, completion: {
self.loadingView.dismiss()
self.infiniteLoadingIndicator.dismiss()
})
}
}
Expand All @@ -66,11 +66,11 @@ class CollectionController: UICollectionViewController {
if offset >= scrollView.contentSize.height {
if let item = self.dataSource.objects.last {
self.loading = true
self.loadingView.present()
self.infiniteLoadingIndicator.present()
let initialIndex = Int(item.valueForKey("name") as! String)! + 1
self.loadItems(initialIndex, completion: {
self.loading = false
self.loadingView.dismiss()
self.infiniteLoadingIndicator.dismiss()
print("loaded items starting at \(item.valueForKey("name"))")
})
}
Expand Down
2 changes: 1 addition & 1 deletion Source/DATASource+UITableViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extension DATASource: UITableViewDataSource {
public func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
var resultTitle: String?

if self.delegate?.respondsToSelector("dataSource:tableView:titleForHeaderInSection:") == true {
if self.delegate?.respondsToSelector(#selector(DATASourceDelegate.dataSource(_:tableView:titleForHeaderInSection:))) == true {
resultTitle = self.delegate?.dataSource?(self, tableView: tableView, titleForHeaderInSection: section)
} else if let sections = self.fetchedResultsController.sections {
resultTitle = sections[section].name
Expand Down
2 changes: 1 addition & 1 deletion TableSwift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ViewController: UITableViewController {
super.viewDidLoad()

self.tableView.registerClass(CustomCell.self, forCellReuseIdentifier: CustomCell.Identifier)
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "saveAction")
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: #selector(ViewController.saveAction))
self.tableView.dataSource = self.dataSource
}

Expand Down

0 comments on commit 22190b8

Please sign in to comment.