diff --git a/Former.xcodeproj/project.pbxproj b/Former.xcodeproj/project.pbxproj index 3ad6ed0..5bdeb19 100644 --- a/Former.xcodeproj/project.pbxproj +++ b/Former.xcodeproj/project.pbxproj @@ -418,7 +418,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -472,7 +472,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -495,7 +495,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.ryo.Former; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -514,7 +514,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.ryo.Former; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Former/Cells/FormSelectorDatePickerCell.swift b/Former/Cells/FormSelectorDatePickerCell.swift index 35bc4b9..640eba8 100644 --- a/Former/Cells/FormSelectorDatePickerCell.swift +++ b/Former/Cells/FormSelectorDatePickerCell.swift @@ -15,6 +15,10 @@ open class FormSelectorDatePickerCell: FormCell, SelectorDatePickerFormableRow { open var selectorDatePicker: UIDatePicker? open var selectorAccessoryView: UIView? + open override var canBecomeFirstResponder: Bool { + return true + } + public private(set) weak var titleLabel: UILabel! public private(set) weak var displayLabel: UILabel! diff --git a/Former/Cells/FormSelectorPickerCell.swift b/Former/Cells/FormSelectorPickerCell.swift index f4be7d1..76889ad 100644 --- a/Former/Cells/FormSelectorPickerCell.swift +++ b/Former/Cells/FormSelectorPickerCell.swift @@ -15,6 +15,10 @@ open class FormSelectorPickerCell: FormCell, SelectorPickerFormableRow { open var selectorPickerView: UIPickerView? open var selectorAccessoryView: UIView? + open override var canBecomeFirstResponder: Bool { + return true + } + public private(set) weak var titleLabel: UILabel! public private(set) weak var displayLabel: UILabel! diff --git a/Former/Commons/FormerProtocol.swift b/Former/Commons/FormerProtocol.swift index 0ab0370..6308ee5 100644 --- a/Former/Commons/FormerProtocol.swift +++ b/Former/Commons/FormerProtocol.swift @@ -10,7 +10,7 @@ import UIKit // MARK: Inline RowFormer -public protocol InlineForm: class { +public protocol InlineForm: AnyObject { var inlineRowFormer: RowFormer { get } func editingDidBegin() @@ -39,7 +39,7 @@ extension ConfigurableInlineForm where Self: RowFormer { // MARK: Selector RowFormer -public protocol SelectorForm: class { +public protocol SelectorForm: AnyObject { func editingDidBegin() func editingDidEnd() @@ -64,7 +64,7 @@ extension UpdatableSelectorForm where Self: RowFormer { public protocol Formable: SelectableForm, UpdatableForm, ConfigurableForm {} -public protocol SelectableForm: class {} +public protocol SelectableForm: AnyObject {} public extension SelectableForm where Self: RowFormer { @@ -77,7 +77,7 @@ public extension SelectableForm where Self: RowFormer { } } -public protocol UpdatableForm: class {} +public protocol UpdatableForm: AnyObject {} public extension UpdatableForm where Self: RowFormer { @@ -97,7 +97,7 @@ public extension UpdatableForm where Self: RowFormer { } } -public protocol ConfigurableForm: class {} +public protocol ConfigurableForm: AnyObject {} public extension ConfigurableForm where Self: RowFormer { diff --git a/Former/Commons/RowFormer.swift b/Former/Commons/RowFormer.swift index 9cc2f18..6878ee0 100644 --- a/Former/Commons/RowFormer.swift +++ b/Former/Commons/RowFormer.swift @@ -8,7 +8,7 @@ import UIKit -public protocol FormableRow: class { +public protocol FormableRow: AnyObject { func updateWithRowFormer(_ rowFormer: RowFormer) } diff --git a/Former/Commons/ViewFormer.swift b/Former/Commons/ViewFormer.swift index 2020862..82ecf5d 100644 --- a/Former/Commons/ViewFormer.swift +++ b/Former/Commons/ViewFormer.swift @@ -8,7 +8,7 @@ import UIKit -public protocol FormableView: class { +public protocol FormableView: AnyObject { func updateWithViewFormer(_ viewFormer: ViewFormer) } diff --git a/Former/RowFormers/PickerRowFormer.swift b/Former/RowFormers/PickerRowFormer.swift index 63997c5..eaef8bd 100644 --- a/Former/RowFormers/PickerRowFormer.swift +++ b/Former/RowFormers/PickerRowFormer.swift @@ -64,7 +64,9 @@ open class PickerRowFormer cell.selectionStyle = .none // UPDATES SELECTED ROW TO 0, IN CASE THE COUNT OF UPDATED PICKER ITEMS ARRAY IS LESS THAN PRIOR ARRAY - self.selectedRow = 0 + if pickerItems.count <= selectedRow { + selectedRow = 0 + } // RELOADS PICKER VIEW TO UPDATE ITEMS IN INLINE PICKER let picker = cell.formPickerView()