Skip to content

Commit

Permalink
help doc to migrate to 2.0 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Barreto committed Sep 22, 2016
1 parent 3a1de26 commit 7aa2d18
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 9 deletions.
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,53 @@
# Change Log
All notable changes to this project will be documented in this file.

### master branch
### [2.0.0-beta.1](https://github.com/xmartlabs/Eureka/releases/tag/2.0.0)

Pull requests associated with this milestone can be found in this [filter](https://github.com/xmartlabs/Eureka/issues?utf8=%E2%9C%93&q=milestone%3A2.0.0%20).

We have made tons of changes in Eureka API to follow the new Swift API design guidelines.
It's hard to enumerate all changes and most of them will be automatically suggested by Xcode.

We have also added to Eureka a extensible build-in validations support.

These are the most important changes...

#### Deleted

* `PostalAddressRow` was removed.
* `ImageRow` was removed.

You can find these both rows under [EurekaCommunity] github organization.

* Row's `func highlightCell()`
* Row's `func unhighlightCell()`
* Cell's `func highlight()`
* Cell's `func unhighlight()`
* Cell's `func didSelect()`

#### Added

* Rows's `var isHighlighted: Bool`.
* Rows's `var isValid: Bool`.
* Row's `func onCellHighlightChanged(_ callback: @escaping (_ cell: Cell, _ row: Self)->()) -> Self `.
* Row's `func onRowValidationChanged(_ callback: @escaping (_ cell: Cell, _ row: Self)->()) -> Self`.
* Row's `func validate() -> [ValidationError]`
* Form's `func validate() -> [ValidationError]`
* Row's `func add<Rule: RuleType>(rule: Rule)`
* Row's `func remove(ruleWithIdentifier: String)`
* `RuleSet<T: Equatable>` type.
* `ValidationOptions` Enum type.
* `RuleType` protocol.
* `ValidationError` type.

##### Fixes

* Fixed textlabel alignment for cells with custom constraints (FieldRow, SegmentedRow, TextAreaRow).
* Set 'Require Only App-Extension-Safe API' to YES to enable code sharing in App Extensions.
* Other bug fixes and minor improvements

Take a look at [2.0.0 Migration guide]() for more information on how to solve breaking changes.

### [1.7.0](https://github.com/xmartlabs/Eureka/releases/tag/1.7.0)

* **Breaking change**: Fixed typo in `hightlightCell`. You must now call / override `highlightCell`.
Expand Down Expand Up @@ -132,3 +173,4 @@ Released on 2015-09-29. This is the initial version.
[mikaoj]: https://github.com/mikaoj
[estebansotoara]: https://github.com/estebansotoara
[dernster]: https://github.com/dernster
[EurekaCommunity]: https://github.com/EurekaCommunity
53 changes: 53 additions & 0 deletions Documentation/Eureka 2.0 Migration Guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Eureka 2.0 Migration Guide

Eureka 2.0.0 includes complete Swift 3 Compatibility and adopts the new [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/). It also includes new validations build-in feature.
Bring support to swift 3 involves some API updates to follow apple Swift API best practices, we have also changed and deprecated some API.

Most important changes will be listed below...

#### Requirements:

Eureka 2.0.0 needs Xcode 8, Swift3+ to work. Minimum supported iOS version is 8.0.

Many properties, methods, types were renamed and Xcode should suggest the fix automatically.



These are some examples:

|Old API| New API|
|----|----|
|`func rowByTag<T: Equatable>(_: String) -> RowOf<T>?`|`func rowBy<T: Equatable>(tag: String) -> RowOf<T>?`|
|`func rowByTag<Row: RowType>(_: String) -> Row?`|`func rowBy<Row: RowType>(tag: String) -> Row?`|
|`func rowByTag(_: String) -> BaseRow?`|`func rowBy(tag: String) -> BaseRow?`|
|`func sectionByTag(_: String) -> Section?`|`func sectionBy(tag: String) -> Section?`|
|`func rowValueHasBeenChanged(_: BaseRow, oldValue: Any?, newValue: Any?)`|`func valueHasBeenChanged(for: BaseRow, oldValue: Any?, newValue: Any?)`|
|`public final func indexPath() -> IndexPath?`|`public final var indexPath: IndexPath?`|
|`func prepareForSegue(_ segue: UIStoryboardSegue)`|`func prepare(for segue: UIStoryboardSegue)`|
|`func presentViewController(_ viewController: VCType!, row: BaseRow, presentingViewController:FormViewController)`|`present(_ viewController: VCType!, row: BaseRow, presentingViewController:FormViewController)`|
|`func createController() -> VCType?`|`func makeController() -> VCType?`|


There are also some breaking changes related with deprecated API:

Removed APIs:

* `PostalAddressRow` and `ImageRow` was deleted.
* row has been deleted. You can find it and many other custom rows at EurekaCommunity [organization account](https://github.com/eurekaCommunity).

`highlightCell` and `unhighlightCell` callbacks were deleted, now we should use `row.isHighlighted` from cell update to check from highlighted status and make UI modification according its value.

In case you want to do something when highligth state switches its value you can set up `onCellHighlightChanged` callback.

Custom Rows changes:

Row generic type no longer specify the value type. Its Value type is inferred from cell specification.

Before:

`public final class WeekDayRow: Row<Set<WeekDay>, WeekDayCell>, RowType`


After:

`public final class WeekDayRow: Row<WeekDayCell>, RowType`
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -853,16 +853,16 @@ section.reload()

#### Don't want to use Eureka custom operators?

As we've said `Form` and `Section` types conform to `MutableCollectionType` and `RangeReplaceableCollectionType`. A Form is a collection of Sections and a Section is a collection of Rows.
As we've said `Form` and `Section` types conform to `MutableCollection` and `RangeReplaceableCollection`. A Form is a collection of Sections and a Section is a collection of Rows.

`RangeReplaceableCollectionType` protocol extension provides many useful methods to modify collection.
`RangeReplaceableCollection` protocol extension provides many useful methods to modify collection.

```swift
extension RangeReplaceableCollectionType {
extension RangeReplaceableCollection {
public mutating func append(newElement: Self.Generator.Element)
public mutating func appendContentsOf<S : SequenceType where S.Generator.Element == Generator.Element>(newElements: S)
public mutating func appendContentsOf<S : Sequence where S.Generator.Element == Generator.Element>(newElements: S)
public mutating func insert(newElement: Self.Generator.Element, atIndex i: Self.Index)
public mutating func insertContentsOf<C : CollectionType where C.Generator.Element == Generator.Element>(newElements: C, at i: Self.Index)
public mutating func insertContentsOf<C : Collection where C.Generator.Element == Generator.Element>(newElements: C, at i: Self.Index)
public mutating func removeAtIndex(index: Self.Index) -> Self.Generator.Element
public mutating func removeRange(subRange: Range<Self.Index>)
public mutating func removeFirst(n: Int)
Expand All @@ -880,7 +880,7 @@ public func +++(left: Form, right: Section) -> Form {
return left
}

public func +=< C : CollectionType where C.Generator.Element == Section>(inout lhs: Form, rhs: C){
public func +=< C : Collection where C.Generator.Element == Section>(inout lhs: Form, rhs: C){
lhs.appendContentsOf(rhs)
}

Expand All @@ -889,7 +889,7 @@ public func <<<(left: Section, right: BaseRow) -> Section {
return left
}

public func +=< C : CollectionType where C.Generator.Element == BaseRow>(inout lhs: Section, rhs: C){
public func +=< C : Collection where C.Generator.Element == BaseRow>(inout lhs: Section, rhs: C){
lhs.appendContentsOf(rhs)
}
```
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/RowType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public protocol TypedRowType: BaseRowType {
var value : Cell.Value? { get set }

func add<Rule: RuleType>(rule: Rule) where Rule.RowValueType == Cell.Value
// func remove<Rule: RuleType>(ruleWithIdentifier: Rule) where Rule.RowValueType == Cell.Value
func remove(ruleWithIdentifier: String)
}

/**
Expand Down

0 comments on commit 7aa2d18

Please sign in to comment.