4/18/2016

NSLocalizedString in Swift

NSLocalizedString in Swift is defined like this:


So, we can use it simply in this way:

For some reason, comment is required...😟

What if I wanna replace some words?:

OK, it works!
But is there any more simple solution?

Inspired by this post on Stack Overflow, I added a small extension to String:


Now I can write this way:

Done! 😄

[Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29)]

No comments:

Post a Comment