-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating the API to a Swift3 style API #39
Conversation
API changes:
Please also pay attention to all the APIs that I did not change. |
Current coverage is 90.01% (diff: 94.81%)@@ master #39 diff @@
==========================================
Files 43 43
Lines 4538 4538
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 4088 4085 -3
- Misses 450 453 +3
Partials 0 0
|
@@ -156,7 +156,7 @@ open class CollectionDataProvider<T: SimpleModel>: ConsistencyManagerListener, B | |||
- parameter completion: Called on the main thread. This is called with the result from the cache. | |||
At this point, the data provider will already have new data, so there's no need to call setData. | |||
*/ | |||
open func fetchDataFromCache(cacheKey: String?, context: Any? = nil, completion: @escaping ([T]?, NSError?)->()) { | |||
open func fetchDataFromCache(withCacheKey cacheKey: String?, context: Any? = nil, completion: @escaping ([T]?, NSError?)->()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative to consider:
fetchCachedData(withKey cacheKey: String?, ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmm...originally liked, but maybe not...I think I prefer cache key because it's consistent naming across different places?
@@ -295,7 +295,7 @@ open class CollectionDataProvider<T: SimpleModel>: ConsistencyManagerListener, B | |||
- parameter shouldCache: If false, we will not persist this to the cache. | |||
- parameter context: This context will be passed onto the cache delegate. Default nil. | |||
*/ | |||
open func removeAtIndex(_ index: Int, shouldCache: Bool = true, context: Any? = nil) { | |||
open func remove(at index: Int, shouldCache: Bool = true, context: Any? = nil) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this should have a noun
removeItem(at index: Int, ...)
removeData(at index: Int, ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so based off Apple's APIs. Apple specifically suggests against this in API guidelines https://swift.org/documentation/api-design-guidelines/ (Omit needless words)
from ^
bad public mutating func removeElement(_ member: Element) -> Element?
good public mutating func remove(_ member: Element) -> Element?
No description provided.