This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#1
141 lines
3.6 KiB
Swift
141 lines
3.6 KiB
Swift
extension String {
|
|
public var wmf_hasText: Bool {
|
|
return !isEmpty
|
|
}
|
|
public var wmf_hasNonWhitespaceText: Bool {
|
|
return wmf_hasText && !self.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
|
|
}
|
|
public var wmf_hasAlphanumericText: Bool {
|
|
return wmf_hasText && (self.components(separatedBy: .alphanumerics).count > 1)
|
|
}
|
|
}
|
|
|
|
extension NSAttributedString {
|
|
public var wmf_hasText: Bool {
|
|
return string.wmf_hasText
|
|
}
|
|
public var wmf_hasNonWhitespaceText: Bool {
|
|
return string.wmf_hasNonWhitespaceText
|
|
}
|
|
}
|
|
|
|
extension UILabel {
|
|
public var wmf_hasText: Bool {
|
|
guard let text = text else {
|
|
return false
|
|
}
|
|
return text.wmf_hasText
|
|
}
|
|
|
|
@objc public var wmf_hasNonWhitespaceText: Bool {
|
|
guard let text = text else {
|
|
return false
|
|
}
|
|
return text.wmf_hasNonWhitespaceText
|
|
}
|
|
|
|
public var wmf_hasAttributedText: Bool {
|
|
guard let attributedText = attributedText else {
|
|
return false
|
|
}
|
|
return attributedText.wmf_hasText
|
|
}
|
|
|
|
public var wmf_hasNonWhitespaceAttributedText: Bool {
|
|
guard let attributedText = attributedText else {
|
|
return false
|
|
}
|
|
return attributedText.wmf_hasNonWhitespaceText
|
|
}
|
|
|
|
public var wmf_hasAnyText: Bool {
|
|
return wmf_hasText || wmf_hasAttributedText
|
|
}
|
|
|
|
public var wmf_hasAnyNonWhitespaceText: Bool {
|
|
return wmf_hasNonWhitespaceText || wmf_hasNonWhitespaceAttributedText
|
|
}
|
|
}
|
|
|
|
extension UITextView {
|
|
public var wmf_hasAnyNonWhitespaceText: Bool {
|
|
return text?.wmf_hasNonWhitespaceText ?? false || attributedText?.wmf_hasNonWhitespaceText ?? false
|
|
}
|
|
}
|
|
|
|
extension UIButton {
|
|
public var wmf_hasText: Bool {
|
|
guard let label = titleLabel else {
|
|
return false
|
|
}
|
|
return label.wmf_hasText
|
|
}
|
|
|
|
public var wmf_hasNonWhitespaceText: Bool {
|
|
guard let label = titleLabel else {
|
|
return false
|
|
}
|
|
return label.wmf_hasNonWhitespaceText
|
|
}
|
|
|
|
public var wmf_hasAttributedText: Bool {
|
|
guard let label = titleLabel else {
|
|
return false
|
|
}
|
|
return label.wmf_hasText
|
|
}
|
|
|
|
public var wmf_hasNonWhitespaceAttributedText: Bool {
|
|
guard let label = titleLabel else {
|
|
return false
|
|
}
|
|
return label.wmf_hasNonWhitespaceText
|
|
}
|
|
|
|
public var wmf_hasAnyText: Bool {
|
|
return wmf_hasText || wmf_hasAttributedText
|
|
}
|
|
|
|
public var wmf_hasAnyNonWhitespaceText: Bool {
|
|
return wmf_hasNonWhitespaceText || wmf_hasNonWhitespaceAttributedText
|
|
}
|
|
}
|
|
|
|
extension UITextField {
|
|
public var wmf_hasText: Bool {
|
|
guard let text = text else {
|
|
return false
|
|
}
|
|
return text.wmf_hasText
|
|
}
|
|
|
|
public var wmf_hasNonWhitespaceText: Bool {
|
|
guard let text = text else {
|
|
return false
|
|
}
|
|
return text.wmf_hasNonWhitespaceText
|
|
}
|
|
|
|
public var wmf_hasAttributedText: Bool {
|
|
guard let attributedText = attributedText else {
|
|
return false
|
|
}
|
|
return attributedText.wmf_hasText
|
|
}
|
|
|
|
public var wmf_hasNonWhitespaceAttributedText: Bool {
|
|
guard let attributedText = attributedText else {
|
|
return false
|
|
}
|
|
return attributedText.wmf_hasNonWhitespaceText
|
|
}
|
|
|
|
public var wmf_hasAnyText: Bool {
|
|
return wmf_hasText || wmf_hasAttributedText
|
|
}
|
|
|
|
public var wmf_hasAnyNonWhitespaceText: Bool {
|
|
return wmf_hasNonWhitespaceText || wmf_hasNonWhitespaceAttributedText
|
|
}
|
|
}
|