Closed hideya closed 8 years ago
@bajtos while working on this, I realised that there are so many lines I need to touch if I try to get rid of all the typedefs used for the success block types. I'm not sure if it is worthwhile because of possibility of including subtile bugs and as we are moving towards swagger-codegen for Swift support.
So, here is a proposal -- cleanup typedefs added after ver 1.3.2, mark extra typedefs "deprecated", and leave other legacy typedefs untouched. This should cleans up the codebase into a better shape without touching too many lines. Does this sound good?
Closing this as PR https://github.com/strongloop/loopback-sdk-ios/pull/101 (that implements the above mentioned proposal) has been merged.
For example,
PersistedModel
'sfindById
method is declared as the following:where,
LBPersistedModelFindSuccessBlock
is typedef'ed asvoid(^)(LBPersistedModel *model)
.When coding in Swift, completion for
findById:
becomes:rather than expanding the typedefs like the following (like when we code in Obj-C):
I think this damages coding experience quite a bit.
In order to avoid this, success/failure block should be declared with plain types (and all the typedefs for success blocks might better be deprecated as they are not really necessary).