Skip to content

Instantly share code, notes, and snippets.

View AltiAntonov's full-sized avatar

Altimir Antonov AltiAntonov

View GitHub Profile
@AltiAntonov
AltiAntonov / gist:f0f86e7cd04c61118e13f753191b5d9e
Last active September 28, 2017 14:45
Convert attributes [Stirng: Any] to Swift 4 attributes [NSAttributedStringKey: Any]
public extension Dictionary {
func toNSAttributedStringKeys() -> [NSAttributedStringKey: Any] {
var atts = [NSAttributedStringKey: Any]()
for key in keys {
if let keyString = key as? String {
atts[NSAttributedStringKey(keyString)] = self[key]
}
}