Skip to content

Commit

Permalink
Merge pull request #1 from linksmt/master
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
linksmt authored Dec 15, 2016
2 parents 2fdc545 + 4322185 commit e9ac3a2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "310647561607FCF8FD41271698A7DE5ED6387596",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {

},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"5B598E61C716C8DF181FB43EC6BAB9B4E67230C8" : 0,
"310647561607FCF8FD41271698A7DE5ED6387596" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "C4E65BC9-68A7-41D1-B0E9-5E8CF9542086",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"5B598E61C716C8DF181FB43EC6BAB9B4E67230C8" : "..",
"310647561607FCF8FD41271698A7DE5ED6387596" : "Former\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "Former",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Former.xcodeproj",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/linksmt\/Former.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "310647561607FCF8FD41271698A7DE5ED6387596"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com:443\/mapo80\/iTextSharp-Monotouch.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5B598E61C716C8DF181FB43EC6BAB9B4E67230C8"
}
]
}
17 changes: 13 additions & 4 deletions Former/Commons/Former.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ public final class Former: NSObject {
public func rowFormer(indexPath: NSIndexPath) -> RowFormer {
return self[indexPath.section][indexPath.row]
}

/// Call when cell has selected.
public func onCellWillSelect(handler: (NSIndexPath -> Void)) -> Self {
onCellWillSelect = handler
return self
}

/// Call when cell has selected.
public func onCellSelected(handler: (NSIndexPath -> Void)) -> Self {
Expand Down Expand Up @@ -639,7 +645,7 @@ public final class Former: NSObject {
}

// MARK: Private

private var onCellWillSelect: ((indexPath: NSIndexPath) -> Void)?
private var onCellSelected: ((indexPath: NSIndexPath) -> Void)?
private var onScroll: ((scrollView: UIScrollView) -> Void)?
private var onBeginDragging: ((scrollView: UIScrollView) -> Void)?
Expand All @@ -656,8 +662,8 @@ public final class Former: NSObject {

private weak var tableView: UITableView?
private weak var inlineRowFormer: RowFormer?
private weak var selectorRowFormer: RowFormer?
private var selectedIndexPath: NSIndexPath?
public private(set) weak var selectorRowFormer: RowFormer?
public private(set) var selectedIndexPath: NSIndexPath?
private var oldBottomContentInset: CGFloat?

private func setupTableView() {
Expand Down Expand Up @@ -845,6 +851,9 @@ extension Former: UITableViewDelegate, UITableViewDataSource {
}

public func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {

onCellWillSelect?(indexPath: indexPath)

endEditing()
deselect(false)
selectedIndexPath = indexPath
Expand Down Expand Up @@ -988,4 +997,4 @@ extension Former: UITableViewDelegate, UITableViewDataSource {
viewFormer.update()
return viewFormer.viewInstance
}
}
}

0 comments on commit e9ac3a2

Please sign in to comment.