-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing error handling for incompatible device artifacts (#41)
- Loading branch information
Showing
7 changed files
with
67 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// String+Extensions.swift | ||
// Tophat | ||
// | ||
// Created by Lukas Romsicki on 2024-12-02. | ||
// Copyright © 2024 Shopify. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension String { | ||
var indefiniteArticle: String { | ||
startsWithVowel ? "an" : "a" | ||
} | ||
} | ||
|
||
extension String { | ||
var isValidURL: Bool { | ||
if let detector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue), | ||
let match = detector.firstMatch(in: self, options: [], range: NSRange(location: 0, length: self.utf16.count)) { | ||
return match.range.length == self.utf16.count | ||
} | ||
|
||
return false | ||
} | ||
} | ||
|
||
extension Character { | ||
var isVowel: Bool { | ||
"aeiou".contains { | ||
String($0).compare(String(self).folding(options: .diacriticInsensitive, locale: nil), options: .caseInsensitive) == .orderedSame | ||
} | ||
} | ||
} | ||
|
||
extension StringProtocol { | ||
var startsWithVowel: Bool { | ||
first?.isVowel == true | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters