What’s NSLocalizedString equivalent in Swift?

Is there an Swift equivalent of NSLocalizedString(…)? In Objective-C, we usually use: NSString *string = NSLocalizedString(@”key”, @”comment”); How can I achieve the same in Swift? I found a function: func NSLocalizedString( key: String, tableName: String? = default, bundle: NSBundle = default, value: String = default, #comment: String) -> String However, it is very long and … Read more

How to provide a localized description with an Error type in Swift?

I am defining a custom error type with Swift 3 syntax and I want to provide a user-friendly description of the error which is returned by the localizedDescription property of the Error object. How can I do it? public enum MyError: Error { case customError var localizedDescription: String { switch self { case .customError: return … Read more