Is there any difference between:
NSRange(location: 0, length: 5)
and:
NSMakeRange(0, 5)
Because Swiftlint
throws a warning when I use NSMakeRange
, but I don't know why.
Thanks for the Help :-)
Is there any difference between:
NSRange(location: 0, length: 5)
and:
NSMakeRange(0, 5)
Because Swiftlint
throws a warning when I use NSMakeRange
, but I don't know why.
Thanks for the Help :-)
Main difference is that
is auto-generated struct init method in Swift and
is just a predefined macro that setts location and length
In general, result is the same, but if you're Swift use first one and if you're writing ObjC code use second ;)
The only difference between them is that
is a constructor for
NSRange
whileis a function which creates a new
NSRange
instance (by using the same constructor inside most likely) and actually is redundant inSwift
I think.Swift
has simply inherited it fromObjective-C
. I would stick to the former