nsstring - Method and Property chaining calls in Swift -
i have been trying understand concept of method chaining in programming i'm little confused. far able call multiple function same class returning self
.
can explain , possibly put quick example on how can call method 1 class , property different class? i'm interested in implementation.
for instance following code demonstrates how method numberfromstring()
nsnumberformatter
class called property doublevalue
nsstring
class called on same line.
var mystring = "123" var mydouble = nsnumberformatter().numberfromstring(mystring)!.doublevalue
can please me understand concept putting quick example similar above code.
thanks
doublevalue
in case being called on instance of nsnumber
, return type of numberfromstring:
method of nsnumberformatter
. nsstring
has same property.
var mystring = "123" var mynumber = nsnumberformatter().numberfromstring(mystring)! var mydouble = mynumber.doublevalue
Comments
Post a Comment