diff --git a/CHANGELOG.md b/CHANGELOG.md index d3f990be1..6b4b1d5c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,21 @@ # Change Log All notable changes to this project will be documented in this file. -### Master branch +### [1.4.1](https://github.com/xmartlabs/Eureka/releases/tag/1.4.1) +Released on 2016-02-25. + +##### Breaking Changes + +* `SelectorRow` now requires the cell among its generic values. This means it is easier to change the cell for a selector row. +* `_AlertRow` and `_ActionSheetRow` require generic cell parameter + +If you are using custom rows that inherit from SelectorRow then you might want to change them as follows (or use your custom cell): +``` +// before +// public final class LocationRow : SelectorRow, RowType +// now +public final class LocationRow : SelectorRow>, RowType +``` ### [1.4.0](https://github.com/xmartlabs/Eureka/releases/tag/1.4.0) diff --git a/Eureka.podspec b/Eureka.podspec index 1cc58473e..b126c60e7 100644 --- a/Eureka.podspec +++ b/Eureka.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Eureka' - s.version = '1.4.0' + s.version = '1.4.1' s.license = 'MIT' s.summary = 'Elegant iOS Forms in pure Swift 2' s.homepage = 'https://github.com/xmartlabs/Eureka' diff --git a/Example/Example/CustomCells.swift b/Example/Example/CustomCells.swift index e4cd2a4d1..ac602cadc 100644 --- a/Example/Example/CustomCells.swift +++ b/Example/Example/CustomCells.swift @@ -456,7 +456,7 @@ public final class EmailFloatLabelRow: FloatFieldRow, RowType { +public final class LocationRow : SelectorRow>, RowType { public required init(tag: String?) { super.init(tag: tag) presentationMode = .Show(controllerProvider: ControllerProvider.Callback { return MapViewController(){ _ in } }, completionCallback: { vc in vc.navigationController?.popViewControllerAnimated(true) }) diff --git a/README.md b/README.md index d7680b50e..15263d70d 100644 --- a/README.md +++ b/README.md @@ -213,9 +213,9 @@ public protocol FormatterProtocol { This row will push to a new controller from where to choose options listed using Check rows. - + **PopoverSelectorRow** + + **PopoverSelectorRow** - This row will show a popover from where to choose options listed using Check rows. + This row will show a popover from where to choose options listed using Check rows. + **ImageRow** diff --git a/Source/Core.swift b/Source/Core.swift index f1fd16c52..06bd2c9eb 100644 --- a/Source/Core.swift +++ b/Source/Core.swift @@ -1683,7 +1683,7 @@ public class Row: OptionsRow>, PresenterRowType { +public class SelectorRow: OptionsRow, PresenterRowType { /// Defines how the view controller will be presented, pushed, etc. public var presentationMode: PresentationMode? @@ -1695,7 +1695,7 @@ public class SelectorRow -> ()) = { _ in }) { + public required convenience init(_ tag: String, @noescape _ initializer: (SelectorRow -> ()) = { _ in }) { self.init(tag:tag) RowDefaults.rowInitialization["\(self.dynamicType)"]?(self) initializer(self) @@ -1743,7 +1743,7 @@ public class SelectorRow>: Row, PushSelectorCell>>, PresenterRowType { +public class GenericMultipleSelectorRow, Cell: BaseCell, Cell.Value == Set>: Row, Cell>, PresenterRowType { /// Defines how the view controller will be presented, pushed, etc. public var presentationMode: PresentationMode? @@ -1765,7 +1765,7 @@ public class GenericMultipleSelectorRow -> ()) = { _ in }) { + public required convenience init(_ tag: String, @noescape _ initializer: (GenericMultipleSelectorRow -> ()) = { _ in }) { self.init(tag:tag) RowDefaults.rowInitialization["\(self.dynamicType)"]?(self) initializer(self) diff --git a/Source/Rows.swift b/Source/Rows.swift index 562c93669..e1acd2022 100644 --- a/Source/Rows.swift +++ b/Source/Rows.swift @@ -531,7 +531,7 @@ public class _SwitchRow: Row { } } -public class _PushRow : SelectorRow> { +public class _PushRow : SelectorRow, Cell> { public required init(tag: String?) { super.init(tag: tag) @@ -539,7 +539,7 @@ public class _PushRow : SelectorRow> } } -public class _PopoverSelectorRow : SelectorRow> { +public class _PopoverSelectorRow : SelectorRow, Cell> { public required init(tag: String?) { super.init(tag: tag) @@ -607,7 +607,7 @@ public class OptionsRow: OptionsRow>, PresenterRowType { +public class _ActionSheetRow: OptionsRow, PresenterRowType { public var onPresentCallback : ((FormViewController, SelectorAlertController)->())? lazy public var presentationMode: PresentationMode>? = { @@ -646,7 +646,7 @@ public class _ActionSheetRow: OptionsRow>, } } -public class _AlertRow: OptionsRow>, PresenterRowType { +public class _AlertRow: OptionsRow, PresenterRowType { public var onPresentCallback : ((FormViewController, SelectorAlertController)->())? lazy public var presentationMode: PresentationMode>? = { @@ -694,13 +694,12 @@ public struct ImageRowSourceTypes : OptionSetType { public static let All: ImageRowSourceTypes = [Camera, PhotoLibrary, SavedPhotosAlbum] } -public class _ImageRow : SelectorRow { +public enum ImageClearAction { + case No + case Yes(style: UIAlertActionStyle) +} - public enum ImageClearAction { - case No - case Yes(style: UIAlertActionStyle) - } - +public class _ImageRow : SelectorRow { public var sourceTypes: ImageRowSourceTypes public internal(set) var imageURL: NSURL? @@ -740,20 +739,18 @@ public class _ImageRow : SelectorRow { super.customDidSelect() return } - deselect() - var availableSources: ImageRowSourceTypes { - var result: ImageRowSourceTypes = [] - - if UIImagePickerController.isSourceTypeAvailable(.PhotoLibrary) { - result.insert(.PhotoLibrary) - } - if UIImagePickerController.isSourceTypeAvailable(.Camera) { - result.insert(.Camera) - } - if UIImagePickerController.isSourceTypeAvailable(.SavedPhotosAlbum) { - result.insert(.SavedPhotosAlbum) - } - return result + deselect() + + var availableSources: ImageRowSourceTypes = [] + + if UIImagePickerController.isSourceTypeAvailable(.PhotoLibrary) { + availableSources.insert(.PhotoLibrary) + } + if UIImagePickerController.isSourceTypeAvailable(.Camera) { + availableSources.insert(.Camera) + } + if UIImagePickerController.isSourceTypeAvailable(.SavedPhotosAlbum) { + availableSources.insert(.SavedPhotosAlbum) } sourceTypes.intersectInPlace(availableSources) @@ -843,7 +840,7 @@ public class _ImageRow : SelectorRow { } } -public class _MultipleSelectorRow : GenericMultipleSelectorRow> { +public class _MultipleSelectorRow> : GenericMultipleSelectorRow, Cell> { public required init(tag: String?) { super.init(tag: tag) self.displayValueFor = { @@ -1319,34 +1316,34 @@ public final class SegmentedRow: OptionsRow>, } /// An options row where the user can select an option from an ActionSheet -public final class ActionSheetRow: _ActionSheetRow, RowType { +public final class ActionSheetRow: _ActionSheetRow>, RowType { required public init(tag: String?) { super.init(tag: tag) } } /// An options row where the user can select an option from a modal Alert -public final class AlertRow: _AlertRow, RowType { +public final class AlertRow: _AlertRow>, RowType { required public init(tag: String?) { super.init(tag: tag) } } /// A selector row where the user can pick an image -public final class ImageRow : _ImageRow, RowType { +public final class ImageRow : _ImageRow>, RowType { public required init(tag: String?) { super.init(tag: tag) } } /// A selector row where the user can pick an option from a pushed view controller -public final class PushRow : _PushRow, RowType { +public final class PushRow : _PushRow>, RowType { public required init(tag: String?) { super.init(tag: tag) } } -public final class PopoverSelectorRow : _PopoverSelectorRow, RowType { +public final class PopoverSelectorRow : _PopoverSelectorRow>, RowType { public required init(tag: String?) { super.init(tag: tag) } @@ -1354,7 +1351,7 @@ public final class PopoverSelectorRow : _PopoverSelectorRow, Ro /// A selector row where the user can pick several options from a pushed view controller -public final class MultipleSelectorRow : _MultipleSelectorRow, RowType { +public final class MultipleSelectorRow : _MultipleSelectorRow>>, RowType { public required init(tag: String?) { super.init(tag: tag) }