Skip to content

Commit

Permalink
Merge pull request #60 from erwald/fix-readme-example
Browse files Browse the repository at this point in the history
Change return type from AnyObject to Any in readme example
  • Loading branch information
nickoneill committed Jan 15, 2017
2 parents 8d4f338 + 37b2f3f commit 6609c2e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ struct Basic: Storable {
self.number = warehouse.get("number") ?? 10
}

func toDictionary() -> [String : AnyObject] {
func toDictionary() -> [String : Any] {
return [ "name": self.name, "age": self.age, "number": self.number ]
}
}
Expand All @@ -133,12 +133,12 @@ Classes are also supported and can be setup the same way Structs are however the
```swift
class ModelBase: Storable {
let id: String

required init(warehouse: Warehouseable) {
self.id = warehouse.get("id") ?? "default_id"
}

func toDictionary() -> [String : AnyObject] {
func toDictionary() -> [String : Any] {
return [ "id": self.id ]
}
}
Expand All @@ -147,16 +147,16 @@ class BasicClassModel: ModelBase {
let name: String
let age: Float
let number: Int

required init(warehouse: Warehouseable) {
self.name = warehouse.get("name") ?? "default"
self.age = warehouse.get("age") ?? 20.5
self.number = warehouse.get("number") ?? 10

super.init(warehouse: warehouse)
}

func toDictionary() -> [String : AnyObject] {
func toDictionary() -> [String : Any] {
var dictionary = super.toDictionary()
dictionary["name"] = self.name
dictionary["age"] = self.age
Expand Down

0 comments on commit 6609c2e

Please sign in to comment.