Skip to content

Commit

Permalink
Fix array map backward compatibility with v3.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
srdanrasic committed Mar 14, 2015
1 parent b642068 commit 47492ad
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Bond.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "Bond"
s.version = "3.3.0"
s.version = "3.3.1"
s.summary = "A Swift binding framework"

s.description = <<-DESC
Expand All @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.social_media_url = "http://twitter.com/srdanrasic"
s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
s.source = { :git => "https://github.com/SwiftBond/Bond.git", :tag => "v3.3.0" }
s.source = { :git => "https://github.com/SwiftBond/Bond.git", :tag => "v3.3.1" }
s.source_files = "Bond"
s.osx.exclude_files = "Bond/Bond+UI*"
s.framework = 'SystemConfiguration'
Expand Down
10 changes: 10 additions & 0 deletions Bond/Bond+Arrays.swift
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,20 @@ public extension DynamicArray
return _map(self, f, DynamicArrayMapCacheValue(count: self.count, repeatedValue: nil))
}

public func map<U>(f: T -> U) -> DynamicArray<U> {
let mapf = { (o: T, i: Int) -> U in f(o) }
return _map(self, mapf, DynamicArrayMapCacheValue(count: self.count, repeatedValue: nil))
}

public func map<U: AnyObject>(f: (T, Int) -> U) -> DynamicArray<U> {
return _map(self, f, DynamicArrayMapCacheObject(count: self.count, repeatedValue: nil))
}

public func map<U: AnyObject>(f: T -> U) -> DynamicArray<U> {
let mapf = { (o: T, i: Int) -> U in f(o) }
return _map(self, mapf, DynamicArrayMapCacheObject(count: self.count, repeatedValue: nil))
}

public func filter(f: T -> Bool) -> DynamicArray<T> {
return _filter(self, f)
}
Expand Down
2 changes: 1 addition & 1 deletion Bond/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.3.0</string>
<string>3.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion BondTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>3.3.0</string>
<string>3.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ override func viewDidLoad() {
tableViewDataSourceBond = UITableViewDataSourceBond(tableView: self.tableView)

// map repositories to cells and bind
repositories.map { [unowned self] (repository: Repository, index: Int) -> RepositoryTableViewCell in
repositories.map { [unowned self] (repository: Repository) -> RepositoryTableViewCell in
let cell = self.tableView.dequeueReusableCellWithIdentifier("cell") as RepositoryTableViewCell
repository.name ->> cell.nameLabel
repository.photo ->> cell.avatarImageView
Expand Down Expand Up @@ -495,7 +495,7 @@ override func viewDidLoad() {

```swift
// map repositories to cells and bind
repositories.map { [unowned self] (repository: Repository, index: Int) -> UITableViewCell in
repositories.map { [unowned self] (repository: Repository) -> UITableViewCell in
let cell = self.tableView.dequeueReusableCellWithIdentifier("cell") as RepositoryTableViewCell
repository.name ->> cell.nameLabel
repository.photo ->> cell.avatarImageView
Expand All @@ -519,13 +519,13 @@ If your table view needs to display more than one section, you can feed it with


```swift
let sectionOfApples = apples.map { [unowned self] (apple: Apple, index: Int) -> UITableViewCell in
let sectionOfApples = apples.map { [unowned self] (apple: Apple) -> UITableViewCell in
let cell = self.tableView.dequeueReusableCellWithIdentifier("cell") as AppleTableViewCell
cell.nameLabel = apple.name
return cell
}

let sectionOfPears = pears.map { [unowned self] (pear: Pear, index: Int) -> UITableViewCell in
let sectionOfPears = pears.map { [unowned self] (pear: Pear) -> UITableViewCell in
let cell = self.tableView.dequeueReusableCellWithIdentifier("cell") as PearTableViewCell
cell.nameLabel = pear.name
return cell
Expand Down

0 comments on commit 47492ad

Please sign in to comment.