We all know that iOS development has been using the Objective-c language before Swift was born. A bridging is required between OC and Swift.
The APIs in iOS are basically written by OC many years ago, and now can be used in swift, and even you can't see the difference, it's very natural. There are some special types that you need to be aware of when handing in two languages, which makes it much easier to invoke the iOS API with OC than Swift.
The first is nsstring, this is the previous form of string, in iOS it and swift string can be converted to each other, even when they are not different, if there is a parameter need to pass a nsstring value, you can directly pass a string into, And vice versa, although they are completely different, but you can still think of them as one thing, in Swift, string is not even a class, just a struct, thanks to Apple's staff.
The old version of the array Nsarray, the bridge to Swift is an array of type anyobject, so as long as you see an array of anyobject types in the iOS API, they were nsarray.
Nsdictionary is bridged in swift bonding is a subclass NSObject object, and the value is anyobject.
then int, float, double, bool are all received from the NSNumber Bridge, NSNumber is OC in all about the value of the object, int, float, double these and C language int, float, double is also bridged good, So if the API has a C-language int parameter, it can also accept an int from Swift
Of course, if you are sure what data type you need, you can do type conversion. For example, length is a property of NSString, does not exist in string, it does not exist in string for a reason, and the new string handles the problem of variable Unicode length, while the old NSString does not handle this problem very well.
The bridging rules of the dictionary are confusing because the roots of the key values sting, int, and so on are not objects, and more unlikely to be nsobject, but you can still use them because the numeric types are bridged to the nsobject subclasses. Most of the time you don't see this kind of bridging, because they're all automatic.
"We all love Paul Hegarty." Stanford IOS8 public class personal note 9 objective-c compatibility