Swift 3到 Swift 4的一些变化

2018-09-28  本文已影响0人  宁静世界

Swift  3
let drawAttrsString = NSMutableAttributedString()

let attrs: [String : Any] = [
                    NSForegroundColorAttributeName : configuration.theme.EMAColor(day: day),
                    NSFontAttributeName : configuration.main.assistTextFont
                ]

drawAttrsString.append(NSAttributedString(string: “xxx”, attributes: attrs))


Swift 4变化为
let attrs: [NSAttributedString.Key : Any] = [
                    NSAttributedString.Key.foregroundColor : configuration.theme.EMAColor(day: day),
                    NSAttributedString.Key.font : configuration.main.assistTextFont
                ]

Swift  3
NSParagraphStyleAttributeName

Swift 4变化为
NSAttributedString.Key.paragraphStyle

上一篇下一篇

猜你喜欢

热点阅读