set(value) { button.setTitle(value, for: .normal) }
}
var hasDestructiveAction: Bool {
- get { return button.tintColor == .red }
- set(value) { button.tintColor = value ? .red : buttonStandardTintColor }
+ get { return button.tintColor == .systemRed }
+ set(value) { button.tintColor = value ? .systemRed : buttonStandardTintColor }
}
var onTapped: (() -> Void)?
let keyLabel = UILabel()
keyLabel.font = UIFont.preferredFont(forTextStyle: .body)
keyLabel.adjustsFontForContentSizeCategory = true
- keyLabel.textColor = .black
+ if #available(iOS 13.0, *) {
+ keyLabel.textColor = .label
+ } else {
+ keyLabel.textColor = .black
+ }
keyLabel.textAlignment = .left
return keyLabel
}()
valueTextField.autocapitalizationType = .none
valueTextField.autocorrectionType = .no
valueTextField.spellCheckingType = .no
- valueTextField.textColor = .gray
+ if #available(iOS 13.0, *) {
+ valueTextField.textColor = .secondaryLabel
+ } else {
+ valueTextField.textColor = .gray
+ }
return valueTextField
}()
var isValueValid = true {
didSet {
- if isValueValid {
- keyLabel.textColor = .black
+ if #available(iOS 13.0, *) {
+ if isValueValid {
+ keyLabel.textColor = .label
+ } else {
+ keyLabel.textColor = .systemRed
+ }
} else {
- keyLabel.textColor = .red
+ if isValueValid {
+ keyLabel.textColor = .black
+ } else {
+ keyLabel.textColor = .red
+ }
}
}
}
get { return switchView.isEnabled }
set(value) {
switchView.isEnabled = value
- textLabel?.textColor = value ? .black : .gray
+ if #available(iOS 13.0, *) {
+ textLabel?.textColor = value ? .label : .secondaryLabel
+ } else {
+ textLabel?.textColor = value ? .black : .gray
+ }
}
}
override func prepareForReuse() {
super.prepareForReuse()
message = ""
- setTextColor(.black)
+ if #available(iOS 13.0, *) {
+ setTextColor(.label)
+ } else {
+ setTextColor(.black)
+ }
setTextAlignment(.left)
}
}
super.init(style: style, reuseIdentifier: reuseIdentifier)
copyableGesture = false
- valueTextField.textColor = .black
+ if #available(iOS 13.0, *) {
+ valueTextField.textColor = .label
+ } else {
+ valueTextField.textColor = .black
+ }
valueTextField.isEnabled = true
valueLabelScrollView.isScrollEnabled = false
valueTextField.widthAnchor.constraint(equalTo: valueLabelScrollView.widthAnchor).isActive = true
}()
let busyIndicator: UIActivityIndicatorView = {
- let busyIndicator = UIActivityIndicatorView(style: .gray)
- busyIndicator.hidesWhenStopped = true
- return busyIndicator
+ if #available(iOS 13.0, *) {
+ let busyIndicator = UIActivityIndicatorView(style: .medium)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ } else {
+ let busyIndicator = UIActivityIndicatorView(style: .gray)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ }
}()
let statusSwitch = UISwitch()
}()
let busyIndicator: UIActivityIndicatorView = {
- let busyIndicator = UIActivityIndicatorView(style: .gray)
- busyIndicator.hidesWhenStopped = true
- return busyIndicator
+ if #available(iOS 13.0, *) {
+ let busyIndicator = UIActivityIndicatorView(style: .medium)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ } else {
+ let busyIndicator = UIActivityIndicatorView(style: .gray)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ }
}()
let paragraphStyle: NSParagraphStyle = {
private func noSSIDsCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
let cell: TextCell = tableView.dequeueReusableCell(for: indexPath)
cell.message = tr("tunnelOnDemandNoSSIDs")
- cell.setTextColor(.gray)
+ if #available(iOS 13.0, *) {
+ cell.setTextColor(.secondaryLabel)
+ } else {
+ cell.setTextColor(.gray)
+ }
cell.setTextAlignment(.center)
return cell
}
}()
let busyIndicator: UIActivityIndicatorView = {
- let busyIndicator = UIActivityIndicatorView(style: .gray)
- busyIndicator.hidesWhenStopped = true
- return busyIndicator
+ if #available(iOS 13.0, *) {
+ let busyIndicator = UIActivityIndicatorView(style: .medium)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ } else {
+ let busyIndicator = UIActivityIndicatorView(style: .gray)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ }
}()
var detailDisplayedTunnel: TunnelContainer?