Do instance references really work in Swift?

前端 未结 3 1544
有刺的猬
有刺的猬 2021-01-19 01:42

I wrote the Objective-C code first

NSMutableString *aStrValue = [NSMutableString stringWithString:@\"Hello\"];
NSMutableDictionary *aMutDict = [NSMutableDict         


        
3条回答
  •  南笙
    南笙 (楼主)
    2021-01-19 02:15

    In swift, String is a Struct. Structs are not reference types in Swift, thus it's copied when you setting it to a dictionary.

提交回复
热议问题