Skip to content

Commit

Permalink
Release 5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Decybel07 committed Apr 25, 2018
1 parent 280b2c1 commit e8ddb26
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Source/IBInspectables/Core/IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ extension IBL10n {

- throws: `fatalError` with message.
*/
public func messageForSetOnlyProperty(_ property: String, _ typeName: String) -> Never {
public func messageForSetOnlyProperty(_ property: String = #function) -> Never {
fatalError(
"The \(property) property for \(typeName) is reserved for the interface builder. It's only for setting"
"The \(property) property for \(type(of: self)) is reserved for the interface builder. It's only for setting"
)
}
}
2 changes: 1 addition & 1 deletion Source/IBInspectables/UIKit/Common/UIBarItem+IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension UIBarItem: IBL10n {

@IBInspectable
public var l10nTitle: String {
get { self.messageForSetOnlyProperty("l10nTitle", "UIBarItem") }
get { self.messageForSetOnlyProperty() }
set { self.title = L10n.shared.string(for: newValue) }
}
}
8 changes: 4 additions & 4 deletions Source/IBInspectables/UIKit/Common/UIButton+IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ extension UIButton: IBL10n {

@IBInspectable
public var l10nTitle: String {
get { self.messageForSetOnlyProperty("l10nTitle", "UIButton") }
get { self.messageForSetOnlyProperty() }
set { self.setTitle(L10n.shared.string(for: newValue), for: .normal) }
}

@IBInspectable
public var l10nHighlightedTitle: String {
get { self.messageForSetOnlyProperty("l10nHighlightedTitle", "UIButton") }
get { self.messageForSetOnlyProperty() }
set { self.setTitle(L10n.shared.string(for: newValue), for: .highlighted) }
}

@IBInspectable
public var l10nSelectedTitle: String {
get { self.messageForSetOnlyProperty("l10nSelectedTitle", "UIButton") }
get { self.messageForSetOnlyProperty() }
set { self.setTitle(L10n.shared.string(for: newValue), for: .selected) }
}

@IBInspectable
public var l10nDisabledTitle: String {
get { self.messageForSetOnlyProperty("l10nDisabledTitle", "UIButton") }
get { self.messageForSetOnlyProperty() }
set { self.setTitle(L10n.shared.string(for: newValue), for: .disabled) }
}
}
2 changes: 1 addition & 1 deletion Source/IBInspectables/UIKit/Common/UILabel+IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension UILabel: IBL10n {

@IBInspectable
public var l10nText: String {
get { self.messageForSetOnlyProperty("l10nText", "UILabel") }
get { self.messageForSetOnlyProperty() }
set { self.text = L10n.shared.string(for: newValue) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension UISegmentedControl: IBL10n {

@IBInspectable
internal var l10nUseSegmentTitleAsKey: Bool {
get { self.messageForSetOnlyProperty("l10nUseSegmentTitleAsKey", "UISegmentedControl") }
get { self.messageForSetOnlyProperty() }
set {
if newValue {
(0 ..< self.numberOfSegments).forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension UITabBarItem {

@IBInspectable
public var l10nBadge: String {
get { self.messageForSetOnlyProperty("l10nTitle", "UITabBarItem") }
get { self.messageForSetOnlyProperty() }
set { self.badgeValue = L10n.shared.string(for: newValue) }
}
}
4 changes: 2 additions & 2 deletions Source/IBInspectables/UIKit/Common/UITextField+IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ extension UITextField: IBL10n {

@IBInspectable
public var l10nText: String {
get { self.messageForSetOnlyProperty("l10nText", "UITextField") }
get { self.messageForSetOnlyProperty() }
set { self.text = L10n.shared.string(for: newValue) }
}

@IBInspectable
public var l10nPlaceholder: String {
get { self.messageForSetOnlyProperty("l10nPlaceholder", "UITextField") }
get { self.messageForSetOnlyProperty() }
set { self.placeholder = L10n.shared.string(for: newValue) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension UIViewController: IBL10n {

@IBInspectable
public var l10nTitle: String {
get { self.messageForSetOnlyProperty("l10nTitle", "UIViewController") }
get { self.messageForSetOnlyProperty() }
set { self.title = L10n.shared.string(for: newValue) }
}
}
2 changes: 1 addition & 1 deletion Source/IBInspectables/UIKit/iOS/UIDatePicker+IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension UIDatePicker: IBL10n {

@IBInspectable
public var l10nUseCurrentLocale: Bool {
get { self.messageForSetOnlyProperty("l10nUseCurrentLocale", "UIDatePicker") }
get { self.messageForSetOnlyProperty() }
set {
if newValue {
self.locale = L10n.shared.locale
Expand Down
6 changes: 3 additions & 3 deletions Source/IBInspectables/UIKit/iOS/UINavigationItem+IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ extension UINavigationItem: IBL10n {

@IBInspectable
public var l10nTitle: String {
get { self.messageForSetOnlyProperty("l10nTitle", "UINavigationItem") }
get { self.messageForSetOnlyProperty() }
set { self.title = L10n.shared.string(for: newValue) }
}

@IBInspectable
public var l10nPrompt: String {
get { self.messageForSetOnlyProperty("l10nPrompt", "UINavigationItem") }
get { self.messageForSetOnlyProperty() }
set { self.prompt = L10n.shared.string(for: newValue) }
}

@IBInspectable
public var l10nBackButton: String {
get { self.messageForSetOnlyProperty("l10nBackButton", "UINavigationItem") }
get { self.messageForSetOnlyProperty() }
set {
if self.backBarButtonItem == nil {
self.backBarButtonItem = UIBarButtonItem()
Expand Down
6 changes: 3 additions & 3 deletions Source/IBInspectables/UIKit/iOS/UISearchBar+IBL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ extension UISearchBar: IBL10n {

@IBInspectable
public var l10nText: String {
get { self.messageForSetOnlyProperty("l10nText", "UISearchBar") }
get { self.messageForSetOnlyProperty() }
set { self.text = L10n.shared.string(for: newValue) }
}

@IBInspectable
public var l10nPrompt: String {
get { self.messageForSetOnlyProperty("l10nPrompt", "UISearchBar") }
get { self.messageForSetOnlyProperty() }
set { self.prompt = L10n.shared.string(for: newValue) }
}

@IBInspectable
public var l10nPlaceholder: String {
get { self.messageForSetOnlyProperty("l10nPlaceholder", "UISearchBar") }
get { self.messageForSetOnlyProperty() }
set { self.placeholder = L10n.shared.string(for: newValue) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public extension UIButton {

@IBInspectable
public var l10nFocusedTitle: String {
get { self.messageForSetOnlyProperty("l10nFocusedTitle", "UIButton") }
get { self.messageForSetOnlyProperty() }
set { self.setTitle(L10n.shared.string(for: newValue), for: .focused) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension WKInterfaceButton: IBL10n {

@IBInspectable
public var l10nTitle: String {
get { self.messageForSetOnlyProperty("l10nTitle", "WKInterfaceButton") }
get { self.messageForSetOnlyProperty() }
set { self.setTitle(L10n.shared.string(for: newValue)) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension WKInterfaceController: IBL10n {

@IBInspectable
public var l10nTitle: String {
get { self.messageForSetOnlyProperty("l10nTitle", "WKInterfaceController") }
get { self.messageForSetOnlyProperty() }
set { self.setTitle(L10n.shared.string(for: newValue)) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension WKInterfaceLabel: IBL10n {

@IBInspectable
public var l10nText: String {
get { self.messageForSetOnlyProperty("l10nTitle", "WKInterfaceLabel") }
get { self.messageForSetOnlyProperty() }
set { self.setText(L10n.shared.string(for: newValue)) }
}
}

0 comments on commit e8ddb26

Please sign in to comment.