Skip to content

Commit

Permalink
Update SampleApp to conform to new cache delegate protocol (#44)
Browse files Browse the repository at this point in the history
Fix minor doc typos
  • Loading branch information
DeepAnchor authored and plivesey committed Oct 25, 2016
1 parent e27ad88 commit 61d560c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions RocketData/CacheDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public protocol CacheDelegate {
In this method, you should save a model in the cache.
For information on threading, see the CacheDelegate docs.

- paramter model: The model to save in the cache.
- parameter model: The model to save in the cache.
- parameter cacheKey: The cache key for this model. This is always equal to the modelIdentifier.
- parameter context: A context you can pass in when saving to the cache.
*/
Expand All @@ -67,7 +67,7 @@ public protocol CacheDelegate {
In this method, you should save a collection of models in the cache.
For information on threading, see the CacheDelegate docs.

- paramter collection: The models to save in the cache. This is defined by the CollectionDataProvider.
- parameter collection: The models to save in the cache. This is defined by the CollectionDataProvider.
- parameter cacheKey: The cache key for this model.
- parameter context: A context you can pass in when saving to the cache.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RocketDataCacheDelegate: CacheDelegate {
completion(modelType.init(data: data) as? T, nil)
}

func setModel<T : SimpleModel>(_ model: T, forKey cacheKey: String, context: Any?) {
func setModel(_ model: SimpleModel, forKey cacheKey: String, context: Any?) {
if let model = model as? SampleAppModel {
cache.setObject(model.data() as NSCoding, forKey: cacheKey, block: nil)
} else {
Expand Down Expand Up @@ -62,7 +62,7 @@ class RocketDataCacheDelegate: CacheDelegate {
completion(collection, nil)
}

func setCollection<T : SimpleModel>(_ collection: [T], forKey cacheKey: String, context: Any?) {
func setCollection(_ collection: [SimpleModel], forKey cacheKey: String, context: Any?) {
// In this method, we're going to store an array of strings for the collection and cache all the models individually
// This means updating one of the models will automatically update the collection

Expand Down

0 comments on commit 61d560c

Please sign in to comment.