2月5日炎辨,蘋果更新了swift 5.2版本羡滑,先看一下官方網(wǎng)站的介紹吧:
Updated for Swift 5.2.
Added the?Methods with Special Names?section with information about syntactic sugar the lets instances of classes, structures, and enumerations be used with function call syntax.
Updated the?Subscript Options?section, now that subscripts support parameters with default values.
Updated the?Self Type?section, now that the?Self?can be used in more contexts.
從內(nèi)容來看,此次更新內(nèi)容不多袋励,主要有三塊。
下面給大家翻譯一下并說說我的理解:
1.增加有語法糖信息功能的特殊名字方法茬故,這種方法用在類、結(jié)構(gòu)體蚁鳖、枚舉等的調(diào)用中磺芭。
syntactic sugar語法糖:無實際功能,可增加程序可讀性醉箕,減少代碼出錯的機會钾腺。
語法糖-百度百科
2.更新了下標(biāo)選項放棒,現(xiàn)在下標(biāo)支持默認的參數(shù)了。
3.更新了self類型的用法间螟,現(xiàn)在self可以用在更多地方了剧辐。(這個還是需要掌握一下的)