Skip to content

Commit b5904cc

Browse files
committed
Address+Woo: New calculated property
1 parent 0eb7c4e commit b5904cc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

WooCommerce/Classes/Model/Address+Woo.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@ extension Address {
1919
return postalAddress.formatted(as: .mailingAddress)
2020
}
2121

22-
/// Returns the (clean) Phone number: contains only decimal digits
22+
/// Returns the (clean) Phone number: contains only decimal digits.
2323
///
2424
var cleanedPhoneNumber: String? {
2525
return phone?.components(separatedBy: CharacterSet.decimalDigits.inverted).joined()
2626
}
2727

28+
/// Returns the (Clean) Phone Number, as an iOS Actionable URL.
29+
///
30+
var cleanedPhoneNumberAsActionableURL: URL? {
31+
guard let phone = cleanedPhoneNumber else {
32+
return nil
33+
}
34+
35+
return URL(string: "telprompt://" + phone)
36+
}
37+
2838
/// Indicates if there is a Phone Number set (and it's not empty).
2939
///
3040
var hasPhoneNumber: Bool {

0 commit comments

Comments
 (0)