Skip to content

Instantly share code, notes, and snippets.

@marybnq
Last active June 9, 2021 16:32
Show Gist options
  • Save marybnq/f765d44cff15ea530e7ee09b0497d020 to your computer and use it in GitHub Desktop.
Save marybnq/f765d44cff15ea530e7ee09b0497d020 to your computer and use it in GitHub Desktop.
A String extension to quickly create NSLocalizedString in Swift
//
// LocalizedStrings.swift
// Localization
//
// Created by Federica Benacquista on 09/06/21.
//
import UIKit
extension String{
/**
@return NSLocalizedString returns an NSLocalizedString with both content and comment set to the string you call this on
*/
var localize: String {
return NSLocalizedString(self, comment: self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment