mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-19 21:15:21 +00:00
COVIDSafe code from version 1.7 (#8)
This commit is contained in:
parent
2063cea613
commit
6f92ff8fb8
38 changed files with 4504 additions and 1281 deletions
|
@ -7,9 +7,41 @@
|
|||
import UIKit
|
||||
import Foundation
|
||||
|
||||
extension UILabel {
|
||||
|
||||
extension UIView {
|
||||
static var localizedKey:UInt8 = 0
|
||||
static var localizedVOLabelKey:UInt8 = 1
|
||||
static var localizedVOHintKey:UInt8 = 2
|
||||
|
||||
@IBInspectable public var localVOLabelKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UIView.localizedVOLabelKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UIView.localizedVOLabelKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
@IBInspectable public var localVOHintKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UIView.localizedVOHintKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UIView.localizedVOHintKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
open override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
if let localizedVOLabelKey = self.localVOLabelKey, localizedVOLabelKey != localizedVOLabelKey.localizedString() {
|
||||
self.accessibilityLabel = localizedVOLabelKey.localizedString()
|
||||
}
|
||||
if let localizedVOHintKey = self.localVOHintKey, localizedVOHintKey != localizedVOHintKey.localizedString() {
|
||||
self.accessibilityHint = localizedVOHintKey.localizedString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension UILabel {
|
||||
|
||||
@IBInspectable public var localizationKey: String? {
|
||||
set {
|
||||
|
@ -19,18 +51,34 @@ extension UILabel {
|
|||
return objc_getAssociatedObject(self, &UILabel.localizedKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@IBInspectable public override var localVOLabelKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UILabel.localizedVOLabelKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UILabel.localizedVOLabelKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
@IBInspectable public override var localVOHintKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UILabel.localizedVOHintKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UILabel.localizedVOHintKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
open override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
guard let localizationKey = self.localizationKey, localizationKey != localizationKey.localizedString() else {
|
||||
return
|
||||
if let localizationKey = self.localizationKey, localizationKey != localizationKey.localizedString() {
|
||||
self.text = localizationKey.localizedString()
|
||||
}
|
||||
self.text = localizationKey.localizedString()
|
||||
}
|
||||
}
|
||||
|
||||
extension UITextView {
|
||||
static var localizedKey:UInt8 = 0
|
||||
|
||||
@IBInspectable public var localizationKey: String? {
|
||||
set {
|
||||
|
@ -51,43 +99,77 @@ extension UITextView {
|
|||
}
|
||||
|
||||
extension UITextField {
|
||||
static var localizedKey:UInt8 = 0
|
||||
|
||||
@IBInspectable public var localizationKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UITextView.localizedKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
objc_setAssociatedObject(self, &UITextField.localizedKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UITextView.localizedKey) as? String
|
||||
return objc_getAssociatedObject(self, &UITextField.localizedKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
@IBInspectable public override var localVOLabelKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UITextField.localizedVOLabelKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UITextField.localizedVOLabelKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
@IBInspectable public override var localVOHintKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UITextField.localizedVOHintKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UITextField.localizedVOHintKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
open override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
guard let localizationKey = self.localizationKey, localizationKey != localizationKey.localizedString() else {
|
||||
return
|
||||
|
||||
if let localizationKey = self.localizationKey, localizationKey != localizationKey.localizedString() {
|
||||
self.placeholder = localizationKey.localizedString()
|
||||
}
|
||||
self.placeholder = localizationKey.localizedString()
|
||||
}
|
||||
}
|
||||
|
||||
extension UIButton {
|
||||
static var localizedKey:UInt8 = 0
|
||||
|
||||
@IBInspectable public var localizationKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UITextView.localizedKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
objc_setAssociatedObject(self, &UIButton.localizedKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UITextView.localizedKey) as? String
|
||||
return objc_getAssociatedObject(self, &UIButton.localizedKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@IBInspectable public override var localVOLabelKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UIButton.localizedVOLabelKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UIButton.localizedVOLabelKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
@IBInspectable public override var localVOHintKey: String? {
|
||||
set {
|
||||
objc_setAssociatedObject(self, &UIButton.localizedVOHintKey, newValue, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
get {
|
||||
return objc_getAssociatedObject(self, &UIButton.localizedVOHintKey) as? String
|
||||
}
|
||||
}
|
||||
|
||||
open override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
guard let localizationKey = self.localizationKey, localizationKey != localizationKey.localizedString() else {
|
||||
return
|
||||
|
||||
if let localizationKey = self.localizationKey, localizationKey != localizationKey.localizedString() {
|
||||
self.setTitle(localizationKey.localizedString(), for: .normal)
|
||||
}
|
||||
self.setTitle(localizationKey.localizedString(), for: .normal)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue