From fe3a4b4b519a94f7e40f2525221a6dbcd8b75a0a Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sat, 7 Apr 2018 16:16:09 +0900 Subject: [PATCH 01/16] Fix typo in AddEventViewController --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ .../Former-Demo/Controllers/AddEventViewController.swift | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 Former-Demo/Former-Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Former-Demo/Former-Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Former-Demo/Former-Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Former-Demo/Former-Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift b/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift index 591e3ef..fffc3c0 100644 --- a/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift +++ b/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift @@ -84,7 +84,7 @@ final class AddEventViewController: FormViewController { $0.datePicker.datePickerMode = .dateAndTime }.displayTextFromDate(String.mediumDateShortTime) let endRow = InlineDatePickerRowFormer() { - $0.titleLabel.text = "Start" + $0.titleLabel.text = "End" $0.titleLabel.textColor = .formerColor() $0.titleLabel.font = .boldSystemFont(ofSize: 15) $0.displayLabel.textColor = .formerSubColor() From 009edfee7d639a61e581101c8467beaed54a675f Mon Sep 17 00:00:00 2001 From: Sergey Pershenkov Date: Thu, 7 Jun 2018 18:54:24 +0300 Subject: [PATCH 02/16] Add onReturn event handler to TextFieldRowFormer --- Former/RowFormers/TextFieldRowFormer.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Former/RowFormers/TextFieldRowFormer.swift b/Former/RowFormers/TextFieldRowFormer.swift index 24d8334..e1b2b10 100644 --- a/Former/RowFormers/TextFieldRowFormer.swift +++ b/Former/RowFormers/TextFieldRowFormer.swift @@ -40,6 +40,12 @@ open class TextFieldRowFormer onTextChanged = handler return self } + + @discardableResult + public final func onReturn(_ handler: @escaping (() -> Void)) -> Self { + onReturn = handler + return self + } open override func cellInitialized(_ cell: T) { super.cellInitialized(cell) @@ -89,9 +95,13 @@ open class TextFieldRowFormer textField.becomeFirstResponder() } } + + // MARK: Fileprivate + + fileprivate final var onReturn: (() -> Void)? // MARK: Private - + private final var onTextChanged: ((String) -> Void)? private final var textColor: UIColor? private final var titleColor: UIColor? @@ -135,6 +145,10 @@ private class Observer: NSObject, UITextFieldDelegate where fileprivate dynamic func textFieldShouldReturn(_ textField: UITextField) -> Bool { guard let textFieldRowFormer = textFieldRowFormer else { return false } + if let returnHandler = textFieldRowFormer.onReturn { + returnHandler() + return false + } if textFieldRowFormer.returnToNextRow { let returnToNextRow = (textFieldRowFormer.former?.canBecomeEditingNext() ?? false) ? textFieldRowFormer.former?.becomeEditingNext : From 94e0a9e7eee40d66b115c143ba01c0dfb8ab08ec Mon Sep 17 00:00:00 2001 From: Sergey Pershenkov Date: Thu, 7 Jun 2018 19:00:05 +0300 Subject: [PATCH 03/16] Add some spaces --- Former/RowFormers/TextFieldRowFormer.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Former/RowFormers/TextFieldRowFormer.swift b/Former/RowFormers/TextFieldRowFormer.swift index e1b2b10..2481079 100644 --- a/Former/RowFormers/TextFieldRowFormer.swift +++ b/Former/RowFormers/TextFieldRowFormer.swift @@ -95,13 +95,13 @@ open class TextFieldRowFormer textField.becomeFirstResponder() } } - + // MARK: Fileprivate - + fileprivate final var onReturn: (() -> Void)? // MARK: Private - + private final var onTextChanged: ((String) -> Void)? private final var textColor: UIColor? private final var titleColor: UIColor? From e7459f1cc29d9299e14f51a8f771767c4b022372 Mon Sep 17 00:00:00 2001 From: Bruno Wernimont Date: Thu, 7 Jun 2018 19:31:10 +0200 Subject: [PATCH 04/16] Migrate Former framework to swift 4.2 --- .../Former-Demo.xcodeproj/project.pbxproj | 4 +- Former.xcodeproj/project.pbxproj | 4 +- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ Former/Cells/FormCell.swift | 2 +- Former/Cells/FormTextFieldCell.swift | 2 +- Former/Commons/Former.swift | 78 +++++++++---------- Former/RowFormers/SwitchRowFormer.swift | 2 +- Former/RowFormers/TextFieldRowFormer.swift | 2 +- 8 files changed, 54 insertions(+), 48 deletions(-) create mode 100644 Former.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Former-Demo/Former-Demo.xcodeproj/project.pbxproj b/Former-Demo/Former-Demo.xcodeproj/project.pbxproj index 939265b..7ddfaff 100644 --- a/Former-Demo/Former-Demo.xcodeproj/project.pbxproj +++ b/Former-Demo/Former-Demo.xcodeproj/project.pbxproj @@ -458,7 +458,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ryo.Former-Demo"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -475,7 +475,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ryo.Former-Demo"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 1; }; name = Release; diff --git a/Former.xcodeproj/project.pbxproj b/Former.xcodeproj/project.pbxproj index e5c3f74..d00ad5d 100644 --- a/Former.xcodeproj/project.pbxproj +++ b/Former.xcodeproj/project.pbxproj @@ -475,7 +475,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.ryo.Former; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -494,7 +494,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.ryo.Former; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/Former.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Former.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Former.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Former/Cells/FormCell.swift b/Former/Cells/FormCell.swift index 447c4a4..019de2e 100644 --- a/Former/Cells/FormCell.swift +++ b/Former/Cells/FormCell.swift @@ -17,7 +17,7 @@ open class FormCell: UITableViewCell, FormableRow { setup() } - override public init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setup() } diff --git a/Former/Cells/FormTextFieldCell.swift b/Former/Cells/FormTextFieldCell.swift index 7797052..c9b2ac8 100644 --- a/Former/Cells/FormTextFieldCell.swift +++ b/Former/Cells/FormTextFieldCell.swift @@ -34,7 +34,7 @@ open class FormTextFieldCell: FormCell, TextFieldFormableRow { super.setup() let titleLabel = UILabel() - titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: UILayoutConstraintAxis.horizontal) + titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: NSLayoutConstraint.Axis.horizontal) titleLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1000), for: .horizontal) titleLabel.translatesAutoresizingMaskIntoConstraints = false contentView.insertSubview(titleLabel, at: 0) diff --git a/Former/Commons/Former.swift b/Former/Commons/Former.swift index 9396e4c..470283f 100644 --- a/Former/Commons/Former.swift +++ b/Former/Commons/Former.swift @@ -10,6 +10,11 @@ import UIKit public final class Former: NSObject { + #if !swift(>=4.2) + public typealias Range = CountableRange + public typealias ClosedRange = CountableClosedRange + #endif + // MARK: Public /** @@ -86,14 +91,6 @@ public final class Former: NSObject { return Array(sectionFormers[range]) } - public subscript(range: CountableRange) -> [SectionFormer] { - return Array(sectionFormers[range]) - } - - public subscript(range: CountableClosedRange) -> [SectionFormer] { - return Array(sectionFormers[range]) - } - /// To find RowFormer from indexPath. public func rowFormer(indexPath: IndexPath) -> RowFormer { return self[indexPath.section][indexPath.row] @@ -283,7 +280,7 @@ public final class Former: NSObject { /// To select row from indexPath. @discardableResult - public func select(indexPath: IndexPath, animated: Bool, scrollPosition: UITableViewScrollPosition = .none) -> Self { + public func select(indexPath: IndexPath, animated: Bool, scrollPosition: UITableView.ScrollPosition = .none) -> Self { if let tableView = tableView { tableView.selectRow(at: indexPath, animated: animated, scrollPosition: scrollPosition) _ = self.tableView(tableView, willSelectRowAt: indexPath) @@ -294,7 +291,7 @@ public final class Former: NSObject { /// To select row from instance of RowFormer. @discardableResult - public func select(rowFormer: RowFormer, animated: Bool, scrollPosition: UITableViewScrollPosition = .none) -> Self { + public func select(rowFormer: RowFormer, animated: Bool, scrollPosition:UITableView.ScrollPosition = .none) -> Self { for (section, sectionFormer) in sectionFormers.enumerated() { if let row = sectionFormer.rowFormers.index(where: { $0 === rowFormer }) { return select(indexPath: IndexPath(row: row, section: section), animated: animated, scrollPosition: scrollPosition) @@ -322,28 +319,28 @@ public final class Former: NSObject { /// Reload sections from section indexSet. @discardableResult - public func reload(sections: IndexSet, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func reload(sections: IndexSet, rowAnimation: UITableView.RowAnimation = .none) -> Self { tableView?.reloadSections(sections, with: rowAnimation) return self } /// Reload sections from instance of SectionFormer. @discardableResult - public func reload(sectionFormer: SectionFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func reload(sectionFormer: SectionFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { guard let section = sectionFormers.index(where: { $0 === sectionFormer }) else { return self } return reload(sections: IndexSet(integer: section), rowAnimation: rowAnimation) } /// Reload rows from indesPaths. @discardableResult - public func reload(indexPaths: [IndexPath], rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func reload(indexPaths: [IndexPath], rowAnimation: UITableView.RowAnimation = .none) -> Self { tableView?.reloadRows(at: indexPaths, with: rowAnimation) return self } /// Reload rows from instance of RowFormer. @discardableResult - public func reload(rowFormer: RowFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func reload(rowFormer: RowFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { for (section, sectionFormer) in sectionFormers.enumerated() { if let row = sectionFormer.rowFormers.index(where: { $0 === rowFormer}) { return reload(indexPaths: [IndexPath(row: row, section: section)], rowAnimation: rowAnimation) @@ -428,13 +425,13 @@ public final class Former: NSObject { /// Insert SectionFormer to index of section with animated updates. @discardableResult - public func insertUpdate(sectionFormer: SectionFormer..., toSection: Int, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(sectionFormer: SectionFormer..., toSection: Int, rowAnimation: UITableView.RowAnimation = .none) -> Self { return insertUpdate(sectionFormers: sectionFormer, toSection: toSection, rowAnimation: rowAnimation) } /// Insert SectionFormers to index of section with animated updates. @discardableResult - public func insertUpdate(sectionFormers: [SectionFormer], toSection: Int, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(sectionFormers: [SectionFormer], toSection: Int, rowAnimation: UITableView.RowAnimation = .none) -> Self { guard !sectionFormers.isEmpty else { return self } removeCurrentInlineRowUpdate() tableView?.beginUpdates() @@ -446,13 +443,13 @@ public final class Former: NSObject { /// Insert SectionFormer to above other SectionFormer with animated updates. @discardableResult - public func insertUpdate(sectionFormer: SectionFormer..., above: SectionFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(sectionFormer: SectionFormer..., above: SectionFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { return insertUpdate(sectionFormers: sectionFormer, above: above, rowAnimation: rowAnimation) } /// Insert SectionFormers to above other SectionFormer with animated updates. @discardableResult - public func insertUpdate(sectionFormers: [SectionFormer], above: SectionFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(sectionFormers: [SectionFormer], above: SectionFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { removeCurrentInlineRowUpdate() for (section, sectionFormer) in self.sectionFormers.enumerated() { if sectionFormer === above { @@ -469,13 +466,13 @@ public final class Former: NSObject { /// Insert SectionFormer to below other SectionFormer with animated updates. @discardableResult - public func insertUpdate(sectionFormer: SectionFormer..., below: SectionFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(sectionFormer: SectionFormer..., below: SectionFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { return insertUpdate(sectionFormers: sectionFormer, below: below, rowAnimation: rowAnimation) } /// Insert SectionFormers to below other SectionFormer with animated updates. @discardableResult - public func insertUpdate(sectionFormers: [SectionFormer], below: SectionFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(sectionFormers: [SectionFormer], below: SectionFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { removeCurrentInlineRowUpdate() for (section, sectionFormer) in self.sectionFormers.enumerated() { if sectionFormer === below { @@ -547,13 +544,13 @@ public final class Former: NSObject { /// Insert RowFormer with animated updates. @discardableResult - public func insertUpdate(rowFormer: RowFormer..., toIndexPath: IndexPath, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(rowFormer: RowFormer..., toIndexPath: IndexPath, rowAnimation: UITableView.RowAnimation = .none) -> Self { return insertUpdate(rowFormers: rowFormer, toIndexPath: toIndexPath, rowAnimation: rowAnimation) } /// Insert RowFormers with animated updates. @discardableResult - public func insertUpdate(rowFormers: [RowFormer], toIndexPath: IndexPath, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(rowFormers: [RowFormer], toIndexPath: IndexPath, rowAnimation: UITableView.RowAnimation = .none) -> Self { removeCurrentInlineRowUpdate() guard !rowFormers.isEmpty else { return self } tableView?.beginUpdates() @@ -568,13 +565,13 @@ public final class Former: NSObject { /// Insert RowFormer to above other RowFormer with animated updates. @discardableResult - public func insertUpdate(rowFormer: RowFormer..., above: RowFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(rowFormer: RowFormer..., above: RowFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { return insertUpdate(rowFormers: rowFormer, above: above, rowAnimation: rowAnimation) } /// Insert RowFormers to above other RowFormer with animated updates. @discardableResult - public func insertUpdate(rowFormers: [RowFormer], above: RowFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(rowFormers: [RowFormer], above: RowFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { removeCurrentInlineRowUpdate() for (section, sectionFormer) in self.sectionFormers.enumerated() { for (row, rowFormer) in sectionFormer.rowFormers.enumerated() { @@ -595,13 +592,13 @@ public final class Former: NSObject { /// Insert RowFormer to below other RowFormer with animated updates. @discardableResult - public func insertUpdate(rowFormer: RowFormer..., below: RowFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(rowFormer: RowFormer..., below: RowFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { return insertUpdate(rowFormers: rowFormer, below: below, rowAnimation: rowAnimation) } /// Insert RowFormers to below other RowFormer with animated updates. @discardableResult - public func insertUpdate(rowFormers: [RowFormer], below: RowFormer, rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func insertUpdate(rowFormers: [RowFormer], below: RowFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self { removeCurrentInlineRowUpdate() for (section, sectionFormer) in self.sectionFormers.enumerated() { for (row, rowFormer) in sectionFormer.rowFormers.enumerated() { @@ -629,7 +626,7 @@ public final class Former: NSObject { /// Remove All SectionFormers with animated updates. @discardableResult - public func removeAllUpdate(rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func removeAllUpdate(rowAnimation: UITableView.RowAnimation = .none) -> Self { let indexSet = IndexSet(integersIn: 0.. 0 else { return self } @@ -661,13 +658,13 @@ public final class Former: NSObject { /// Remove SectionFormers from instances of SectionFormer with animated updates. @discardableResult - public func removeUpdate(sectionFormer: SectionFormer..., rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func removeUpdate(sectionFormer: SectionFormer..., rowAnimation: UITableView.RowAnimation = .none) -> Self { return removeUpdate(sectionFormers: sectionFormer, rowAnimation: rowAnimation) } /// Remove SectionFormers from instances of SectionFormer with animated updates. @discardableResult - public func removeUpdate(sectionFormers: [SectionFormer], rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func removeUpdate(sectionFormers: [SectionFormer], rowAnimation: UITableView.RowAnimation = .none) -> Self { guard !sectionFormers.isEmpty else { return self } let indexSet = removeSectionFormers(sectionFormers) guard indexSet.count > 0 else { return self } @@ -692,13 +689,13 @@ public final class Former: NSObject { /// Remove RowFormers with animated updates. @discardableResult - public func removeUpdate(rowFormer: RowFormer..., rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func removeUpdate(rowFormer: RowFormer..., rowAnimation: UITableView.RowAnimation = .none) -> Self { return removeUpdate(rowFormers: rowFormer, rowAnimation: rowAnimation) } /// Remove RowFormers with animated updates. @discardableResult - public func removeUpdate(rowFormers: [RowFormer], rowAnimation: UITableViewRowAnimation = .none) -> Self { + public func removeUpdate(rowFormers: [RowFormer], rowAnimation: UITableView.RowAnimation = .none) -> Self { removeCurrentInlineRowUpdate() guard !rowFormers.isEmpty else { return self } tableView?.beginUpdates() @@ -733,8 +730,9 @@ public final class Former: NSObject { private func setupTableView() { tableView?.delegate = self tableView?.dataSource = self - NotificationCenter.default.addObserver(self, selector: #selector(Former.keyboardWillAppear(notification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(Former.keyboardWillDisappear(notification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil) + + NotificationCenter.default.addObserver(self, selector: #selector(Former.keyboardWillAppear(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(Former.keyboardWillDisappear(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil) } fileprivate func removeCurrentInlineRow() -> IndexPath? { @@ -823,7 +821,7 @@ public final class Former: NSObject { if case let (tableView?, cell?) = (tableView, findCellWithSubView(findFirstResponder(tableView))) { - let frame = (keyboardInfo[UIKeyboardFrameEndUserInfoKey]! as AnyObject).cgRectValue + let frame = (keyboardInfo[UIResponder.keyboardFrameEndUserInfoKey]! as AnyObject).cgRectValue let keyboardFrame = tableView.window!.convert(frame!, to: tableView.superview!) let bottomInset = tableView.frame.minY + tableView.frame.height - keyboardFrame.minY guard bottomInset > 0 else { return } @@ -831,13 +829,13 @@ public final class Former: NSObject { if oldBottomContentInset == nil { oldBottomContentInset = tableView.contentInset.bottom } - let duration = (keyboardInfo[UIKeyboardAnimationDurationUserInfoKey]! as AnyObject).doubleValue! - let curve = (keyboardInfo[UIKeyboardAnimationCurveUserInfoKey]! as AnyObject).integerValue! + let duration = (keyboardInfo[UIResponder.keyboardAnimationDurationUserInfoKey]! as AnyObject).doubleValue! + let curve = (keyboardInfo[UIResponder.keyboardAnimationCurveUserInfoKey]! as AnyObject).integerValue! guard let indexPath = tableView.indexPath(for: cell) else { return } UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(duration) - UIView.setAnimationCurve(UIViewAnimationCurve(rawValue: curve)!) + UIView.setAnimationCurve(UIView.AnimationCurve(rawValue: curve)!) tableView.contentInset.bottom = bottomInset tableView.scrollIndicatorInsets.bottom = bottomInset tableView.scrollToRow(at: indexPath, at: .none, animated: false) @@ -849,12 +847,12 @@ public final class Former: NSObject { guard let keyboardInfo = notification.userInfo else { return } if case let (tableView?, inset?) = (tableView, oldBottomContentInset) { - let duration = (keyboardInfo[UIKeyboardAnimationDurationUserInfoKey]! as AnyObject).doubleValue! - let curve = (keyboardInfo[UIKeyboardAnimationCurveUserInfoKey]! as AnyObject).integerValue! + let duration = (keyboardInfo[UIResponder.keyboardAnimationDurationUserInfoKey]! as AnyObject).doubleValue! + let curve = (keyboardInfo[UIResponder.keyboardAnimationCurveUserInfoKey]! as AnyObject).integerValue! UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(duration) - UIView.setAnimationCurve(UIViewAnimationCurve(rawValue: curve)!) + UIView.setAnimationCurve(UIView.AnimationCurve(rawValue: curve)!) tableView.contentInset.bottom = inset tableView.scrollIndicatorInsets.bottom = inset UIView.commitAnimations() diff --git a/Former/RowFormers/SwitchRowFormer.swift b/Former/RowFormers/SwitchRowFormer.swift index 693af6a..01ac46b 100644 --- a/Former/RowFormers/SwitchRowFormer.swift +++ b/Former/RowFormers/SwitchRowFormer.swift @@ -76,7 +76,7 @@ open class SwitchRowFormer private final var onSwitchChanged: ((Bool) -> Void)? private final var titleColor: UIColor? - private final var selectionStyle: UITableViewCellSelectionStyle? + private final var selectionStyle: UITableViewCell.SelectionStyle? @objc private dynamic func switchChanged(_ switchButton: UISwitch) { if self.enabled { diff --git a/Former/RowFormers/TextFieldRowFormer.swift b/Former/RowFormers/TextFieldRowFormer.swift index 24d8334..fd20b34 100644 --- a/Former/RowFormers/TextFieldRowFormer.swift +++ b/Former/RowFormers/TextFieldRowFormer.swift @@ -45,7 +45,7 @@ open class TextFieldRowFormer super.cellInitialized(cell) let textField = cell.formTextField() textField.delegate = observer - let events: [(Selector, UIControlEvents)] = [(#selector(TextFieldRowFormer.textChanged(textField:)), .editingChanged), + let events: [(Selector, UIControl.Event)] = [(#selector(TextFieldRowFormer.textChanged(textField:)), .editingChanged), (#selector(TextFieldRowFormer.editingDidBegin(textField:)), .editingDidBegin), (#selector(TextFieldRowFormer.editingDidEnd(textField:)), .editingDidEnd)] events.forEach { From 0fd6e162e7b805a92b2b04bb9a6063061d9b5cb9 Mon Sep 17 00:00:00 2001 From: Bruno Wernimont Date: Thu, 7 Jun 2018 19:41:45 +0200 Subject: [PATCH 05/16] Migrate sample projet to swift 4.2 --- Former-Demo/Former-Demo/AppDelegate.swift | 6 ++--- .../Controllers/AddEventViewController.swift | 4 ++-- .../CustomCellViewController.swift | 2 +- .../Controllers/DefaultsViewController.swift | 2 +- .../Controllers/ExampleViewController.swift | 24 +++++++++---------- .../Views/FormerInputAccessoryView.swift | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Former-Demo/Former-Demo/AppDelegate.swift b/Former-Demo/Former-Demo/AppDelegate.swift index 94d0014..117213e 100644 --- a/Former-Demo/Former-Demo/AppDelegate.swift +++ b/Former-Demo/Former-Demo/AppDelegate.swift @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) let navigationController = UINavigationController(rootViewController: TopViewContoller()) configureNavigationBar(navigationBar: navigationController.navigationBar) @@ -25,8 +25,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private func configureNavigationBar(navigationBar: UINavigationBar) { navigationBar.tintColor = .white navigationBar.titleTextAttributes = [ - NSAttributedStringKey.foregroundColor: UIColor.white, - NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 20) + NSAttributedString.Key.foregroundColor: UIColor.white, + NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 20) ] navigationBar.isTranslucent = false navigationBar.shadowImage = UIImage() diff --git a/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift b/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift index fffc3c0..7388373 100644 --- a/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift +++ b/Former-Demo/Former-Demo/Controllers/AddEventViewController.swift @@ -125,7 +125,7 @@ final class AddEventViewController: FormViewController { let never = Repeat.Never $0.pickerItems.append( InlinePickerItem(title: never.title(), - displayTitle: NSAttributedString(string: never.title(), attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray]), + displayTitle: NSAttributedString(string: never.title(), attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]), value: never) ) $0.pickerItems += Repeat.values().map { @@ -142,7 +142,7 @@ final class AddEventViewController: FormViewController { let none = Alert.None $0.pickerItems.append( InlinePickerItem(title: none.title(), - displayTitle: NSAttributedString(string: none.title(), attributes: [NSAttributedStringKey.foregroundColor: UIColor.lightGray]), + displayTitle: NSAttributedString(string: none.title(), attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray]), value: none) ) $0.pickerItems += Alert.values().map { diff --git a/Former-Demo/Former-Demo/Controllers/CustomCellViewController.swift b/Former-Demo/Former-Demo/Controllers/CustomCellViewController.swift index 6221f29..80c8fb2 100644 --- a/Former-Demo/Former-Demo/Controllers/CustomCellViewController.swift +++ b/Former-Demo/Former-Demo/Controllers/CustomCellViewController.swift @@ -43,7 +43,7 @@ final class CustomCellViewController: FormViewController { $0.body = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." $0.bodyColor = colors[0] }.configure { - $0.rowHeight = UITableViewAutomaticDimension + $0.rowHeight = UITableView.automaticDimension } let colorListRow = CustomRowFormer(instantiateType: .Nib(nibName: "ColorListCell")) { diff --git a/Former-Demo/Former-Demo/Controllers/DefaultsViewController.swift b/Former-Demo/Former-Demo/Controllers/DefaultsViewController.swift index cc97d4b..b9e26cd 100644 --- a/Former-Demo/Former-Demo/Controllers/DefaultsViewController.swift +++ b/Former-Demo/Former-Demo/Controllers/DefaultsViewController.swift @@ -71,7 +71,7 @@ final class DefaultsViewController: FormViewController { $0.titleLabel.text = "Segmented" }.configure { $0.segmentTitles = ["Opt1", "Opt2", "Opt3"] - $0.selectedIndex = UISegmentedControlNoSegment + $0.selectedIndex = UISegmentedControl.noSegment } let sliderRow = SliderRowFormer(){ diff --git a/Former-Demo/Former-Demo/Controllers/ExampleViewController.swift b/Former-Demo/Former-Demo/Controllers/ExampleViewController.swift index c449ab9..5b841b9 100644 --- a/Former-Demo/Former-Demo/Controllers/ExampleViewController.swift +++ b/Former-Demo/Former-Demo/Controllers/ExampleViewController.swift @@ -9,13 +9,13 @@ import UIKit import Former -private extension UITableViewRowAnimation { +private extension UITableView.RowAnimation { static func names() -> [String] { return ["None", "Fade", "Right", "Left", "Top", "Bottom", "Middle", "Automatic"] } - static func all() -> [UITableViewRowAnimation] { + static func all() -> [UITableView.RowAnimation] { return [.none, .fade, .right, .left, .top, .bottom, .middle, .automatic] } } @@ -96,17 +96,17 @@ final class ExampleViewController: FormViewController { self?.insertRowPosition = InsertPosition(rawValue: index)! } - let insertRowAnimationRow = InlinePickerRowFormer(instantiateType: .Class) { + let insertRowAnimationRow = InlinePickerRowFormer(instantiateType: .Class) { $0.titleLabel.text = "Animation" $0.titleLabel.textColor = .formerColor() $0.titleLabel.font = .boldSystemFont(ofSize: 16) $0.displayLabel.textColor = .formerSubColor() $0.displayLabel.font = .boldSystemFont(ofSize: 14) }.configure { - $0.pickerItems = UITableViewRowAnimation.names().enumerated().map { - InlinePickerItem(title: $0.element, value: UITableViewRowAnimation.all()[$0.offset]) + $0.pickerItems = UITableView.RowAnimation.names().enumerated().map { + InlinePickerItem(title: $0.element, value: UITableView.RowAnimation.all()[$0.offset]) } - $0.selectedRow = UITableViewRowAnimation.all().index(of: insertRowAnimation) ?? 0 + $0.selectedRow = UITableView.RowAnimation.all().index(of: insertRowAnimation) ?? 0 $0.displayEditingColor = .formerHighlightedSubColor() }.onValueChanged { [weak self] in self?.insertRowAnimation = $0.value! @@ -137,17 +137,17 @@ final class ExampleViewController: FormViewController { self?.insertSectionPosition = InsertPosition(rawValue: index)! } - let insertSectionAnimationRow = InlinePickerRowFormer(instantiateType: .Class) { + let insertSectionAnimationRow = InlinePickerRowFormer(instantiateType: .Class) { $0.titleLabel.text = "Animation" $0.titleLabel.textColor = .formerColor() $0.titleLabel.font = .boldSystemFont(ofSize: 16) $0.displayLabel.textColor = .formerSubColor() $0.displayLabel.font = .boldSystemFont(ofSize: 14) }.configure { - $0.pickerItems = UITableViewRowAnimation.names().enumerated().map { - InlinePickerItem(title: $0.element, value: UITableViewRowAnimation.all()[$0.offset]) + $0.pickerItems = UITableView.RowAnimation.names().enumerated().map { + InlinePickerItem(title: $0.element, value: UITableView.RowAnimation.all()[$0.offset]) } - $0.selectedRow = UITableViewRowAnimation.all().index(of: insertSectionAnimation) ?? 0 + $0.selectedRow = UITableView.RowAnimation.all().index(of: insertSectionAnimation) ?? 0 $0.displayEditingColor = .formerHighlightedSubColor() }.onValueChanged { [weak self] in self?.insertSectionAnimation = $0.value! @@ -263,8 +263,8 @@ final class ExampleViewController: FormViewController { case Below, Above } - private var insertRowAnimation = UITableViewRowAnimation.left - private var insertSectionAnimation = UITableViewRowAnimation.fade + private var insertRowAnimation = UITableView.RowAnimation.left + private var insertSectionAnimation = UITableView.RowAnimation.fade private var insertRowPosition: InsertPosition = .Below private var insertSectionPosition: InsertPosition = .Below diff --git a/Former-Demo/Former-Demo/Views/FormerInputAccessoryView.swift b/Former-Demo/Former-Demo/Views/FormerInputAccessoryView.swift index e996b2a..be0f25d 100644 --- a/Former-Demo/Former-Demo/Views/FormerInputAccessoryView.swift +++ b/Former-Demo/Former-Demo/Views/FormerInputAccessoryView.swift @@ -37,10 +37,10 @@ final class FormerInputAccessoryView: UIToolbar { isUserInteractionEnabled = true let flexible = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) - let leftArrow = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem(rawValue: 105)!, target: self, action: #selector(FormerInputAccessoryView.handleBackButton)) + let leftArrow = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem(rawValue: 105)!, target: self, action: #selector(FormerInputAccessoryView.handleBackButton)) let space = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) space.width = 20 - let rightArrow = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem(rawValue: 106)!, target: self, action: #selector(FormerInputAccessoryView.handleForwardButton)) + let rightArrow = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem(rawValue: 106)!, target: self, action: #selector(FormerInputAccessoryView.handleForwardButton)) let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(FormerInputAccessoryView.handleDoneButton)) let rightSpace = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) setItems([leftArrow, space, rightArrow, flexible, doneButton, rightSpace], animated: false) From eb03a1c8c3444e24a28175e80b6e591a579c7082 Mon Sep 17 00:00:00 2001 From: Sergey Pershenkov Date: Sat, 9 Jun 2018 13:06:25 +0300 Subject: [PATCH 06/16] Pass textField.text to onReturn handler --- Former/RowFormers/TextFieldRowFormer.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Former/RowFormers/TextFieldRowFormer.swift b/Former/RowFormers/TextFieldRowFormer.swift index 2481079..e6809b9 100644 --- a/Former/RowFormers/TextFieldRowFormer.swift +++ b/Former/RowFormers/TextFieldRowFormer.swift @@ -42,7 +42,7 @@ open class TextFieldRowFormer } @discardableResult - public final func onReturn(_ handler: @escaping (() -> Void)) -> Self { + public final func onReturn(_ handler: @escaping ((String) -> Void)) -> Self { onReturn = handler return self } @@ -98,7 +98,7 @@ open class TextFieldRowFormer // MARK: Fileprivate - fileprivate final var onReturn: (() -> Void)? + fileprivate final var onReturn: ((String) -> Void)? // MARK: Private @@ -146,7 +146,7 @@ private class Observer: NSObject, UITextFieldDelegate where fileprivate dynamic func textFieldShouldReturn(_ textField: UITextField) -> Bool { guard let textFieldRowFormer = textFieldRowFormer else { return false } if let returnHandler = textFieldRowFormer.onReturn { - returnHandler() + returnHandler(textField.text ?? "") return false } if textFieldRowFormer.returnToNextRow { From e67e4cbaa2fec7e1d8f129221fc6976c6b633ece Mon Sep 17 00:00:00 2001 From: Alexander Heinrich Date: Thu, 28 Jun 2018 16:45:46 +0200 Subject: [PATCH 07/16] Two redeclarations have become invalid in the newest Swift and Xcode Beta. Because the types do now inherit from Range and ClosedRange so it is not necessary to create an extra subscript for both. --- Former/Commons/Former.swift | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Former/Commons/Former.swift b/Former/Commons/Former.swift index 9396e4c..c03aaf2 100644 --- a/Former/Commons/Former.swift +++ b/Former/Commons/Former.swift @@ -86,14 +86,6 @@ public final class Former: NSObject { return Array(sectionFormers[range]) } - public subscript(range: CountableRange) -> [SectionFormer] { - return Array(sectionFormers[range]) - } - - public subscript(range: CountableClosedRange) -> [SectionFormer] { - return Array(sectionFormers[range]) - } - /// To find RowFormer from indexPath. public func rowFormer(indexPath: IndexPath) -> RowFormer { return self[indexPath.section][indexPath.row] From 3f12430385131f2ee9bfcb0060dfbc0a088e9266 Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Tue, 18 Sep 2018 02:54:06 +0900 Subject: [PATCH 08/16] Update README --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a8645d3..cb3e2f4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![MIT License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/ra1028/Former/master/LICENSE) +## Maintainers Wanted +I'm losing `Former` development willingness now. +If you are willing to develop in place of me, please feel free to contact me. +I'll grant you authority associated with `Former` development. + ## Demo From 8a131212613680e0173a8f84b7b4d185b2061d43 Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Thu, 20 Sep 2018 18:32:55 +0900 Subject: [PATCH 09/16] Update versions --- .swift-version | 2 +- Former.podspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.swift-version b/.swift-version index 5186d07..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +4.2 diff --git a/Former.podspec b/Former.podspec index 28144b0..1ad3557 100644 --- a/Former.podspec +++ b/Former.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Former" - spec.version = "1.6.1" + spec.version = "1.7.0" spec.author = { "ra1028" => "r.fe51028.r@gmail.com" } spec.homepage = "https://github.com/ra1028" spec.summary = "Former is a fully customizable Swift library for easy creating UITableView based form." From 38aa83cecb8cb05efe706bc9b66fd8a6e7536182 Mon Sep 17 00:00:00 2001 From: David Greco Date: Wed, 3 Oct 2018 00:48:26 -0600 Subject: [PATCH 10/16] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..465540e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dave.greco@icloud.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ From 01d6c4ace565050d6fd4c9805d31bc534a00451d Mon Sep 17 00:00:00 2001 From: David Greco Date: Wed, 3 Oct 2018 00:52:21 -0600 Subject: [PATCH 11/16] Create CONTRIBUTING.md --- CONTRIBUTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3a0e8f9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,13 @@ +## Contributing +If you're interesting in helping us improve and maintain Former, it is highly encouraged that you fork the repository and submit a pull request with your updates. + +If you do chose to submit a pull request, please make sure to clearly document what changes you have made in the description of the PR. + +## Submitting Issues +If you find yourself having any issues with Former, feel free to submit an issue. Please BE SURE to include the following: + +* TITLE +* ISSUE DESCRIPTION +* HOW TO REPLICATE ISSUE + +If your issue doesn't contain this information, it will be closed due to lack of information. From 74faf3b5f2ad5f2ab6eb19bf37f6bdae3d12a673 Mon Sep 17 00:00:00 2001 From: David Greco Date: Wed, 3 Oct 2018 01:05:38 -0600 Subject: [PATCH 12/16] Update CONTRIBUTING.md --- CONTRIBUTING.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a0e8f9..8995d08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,6 @@ ## Contributing If you're interesting in helping us improve and maintain Former, it is highly encouraged that you fork the repository and submit a pull request with your updates. -If you do chose to submit a pull request, please make sure to clearly document what changes you have made in the description of the PR. +If you do chose to submit a pull request, please make sure to clearly document what changes you have made in the description of the PR. -## Submitting Issues -If you find yourself having any issues with Former, feel free to submit an issue. Please BE SURE to include the following: - -* TITLE -* ISSUE DESCRIPTION -* HOW TO REPLICATE ISSUE - -If your issue doesn't contain this information, it will be closed due to lack of information. +We will try to get this merged as soon as possible and included in an official cocoapod release as soon as it makes sense to do so. From 12f2666bb1da44d784185d84b99b7f442bd0a854 Mon Sep 17 00:00:00 2001 From: David Greco Date: Fri, 5 Oct 2018 14:02:22 -0600 Subject: [PATCH 13/16] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 35 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 17 +++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..b735373 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,35 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..066b2d9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 3256578df15e9e9ae6a7c1a717299575e52b766d Mon Sep 17 00:00:00 2001 From: David Greco Date: Fri, 5 Oct 2018 14:09:46 -0600 Subject: [PATCH 14/16] Update README.md Added new information and links around submitting issues and feature requests. --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cb3e2f4..31cb26f 100644 --- a/README.md +++ b/README.md @@ -507,13 +507,10 @@ If you're interesting in helping us improve and maintain Former, it is highly en If you do chose to submit a pull request, please make sure to clearly document what changes you have made in the description of the PR. ## Submitting Issues -If you find yourself having any issues with Former, feel free to submit an issue. Please BE SURE to include the following: +Click [HERE](https://github.com/ra1028/Former/issues/new?template=bug_report.md) to get started with filing a bug report. Please use this template to ensure that your issue doesn't get closed due to lack of information. -* TITLE -* ISSUE DESCRIPTION -* HOW TO REPLICATE ISSUE - -If your issue doesn't contain this information, it will be closed due to lack of information. +## Submitting Feature Requests +Click [HERE](https://github.com/ra1028/Former/issues/new?template=feature_request.md) to get started with filing a feature request. Please use this template to ensure that your feature request doesn't get denied due to lack of information. Also please keep in mind that while we desire to make this work as well as possible for everyone we won't be able to accomodate all feature requests due to lack of time or alignment with the direction of the plugin, and you may need to consider contributing even if we agree that a feature would benefit the plugin. ## License Former is available under the MIT license. See the LICENSE file for more info. From 2dc700142f108e0099e60ae3fbcbed755bc3cb64 Mon Sep 17 00:00:00 2001 From: David Greco Date: Fri, 5 Oct 2018 14:15:54 -0600 Subject: [PATCH 15/16] Update README.md Added table of contents nav link to submitting feature requests. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 31cb26f..db1e35b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ I'll grant you authority associated with `Former` development. + [Customizability](#customizability) * [Contributing](#contributing) * [Submitting Issues](#submitting-issues) +* [Submitting Feature Requests](#submitting-feature-requests) * [License](#license) ## Requirements From 4d5634f2e2ddf1cd9b77698c0ef07e6c03530796 Mon Sep 17 00:00:00 2001 From: ushisantoasobu Date: Tue, 16 Oct 2018 12:39:31 +0900 Subject: [PATCH 16/16] fix InlinePickerRowFormer bug --- Former/RowFormers/InlinePickerRowFormer.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Former/RowFormers/InlinePickerRowFormer.swift b/Former/RowFormers/InlinePickerRowFormer.swift index a913246..5ed89b3 100644 --- a/Former/RowFormers/InlinePickerRowFormer.swift +++ b/Former/RowFormers/InlinePickerRowFormer.swift @@ -73,10 +73,12 @@ open class InlinePickerRowFormer if pickerItems.isEmpty { displayLabel?.text = "" } else { - -// Sets selected row to 0 to avoid 'index out of range' error. This is in case the updated picker items array count -// is less than the prior array count. - selectedRow = 0 + + // Sets selected row to 0 to avoid 'index out of range' error. This is in case the updated picker items array count + // is less than the prior array count. + if pickerItems.count <= selectedRow { + selectedRow = 0 + } displayLabel?.text = pickerItems[selectedRow].title _ = pickerItems[selectedRow].displayTitle.map { displayLabel?.attributedText = $0 }