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
import Foundation | |
extension String.Encoding { | |
/// Creates a new instance using the specified IANA charset name. | |
public init?(charsetName name: String) { | |
let match = name | |
.lowercased() | |
.replacing("-", with: "") | |
.replacing("_", with: "") |
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
import SwiftUI | |
extension View { | |
/// Presents a form sheet when a binding to a Boolean value that you provide is true. | |
/// - Parameters: | |
/// - isPresented: A binding to a Boolean value that determines whether | |
/// to present the sheet that you create in the modifier's | |
/// `content` closure. | |
/// - interactiveDismiss: A Boolean value that indicates whether to |
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
import Foundation | |
/// A type-erased codable wrapper. | |
public struct AnyCodable { | |
public typealias Value = any Codable & Hashable | |
public let value: Value | |
/// Creates an instance that type-erases a value. |
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
import SwiftUI | |
/// Describe a potentially destructive action to the user. | |
/// | |
/// A confirmation describes the action to the user and provides a mechanism for confirming the action in the | |
/// form of a `Button`. You present a confirmation by calling the environment's confirm action: | |
/// | |
/// ```swift | |
/// @Environment(\.confirm) private var confirm | |
/// |
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
- (NSString *)indefiniteArticleForWord:(NSString *)word singularArticle:(NSString *)singularArticle pluralArticle:(NSString *)pluralArticle | |
{ | |
NSString *firstLetter = [[word lowercaseString] substringToIndex:1]; | |
NSArray *vowels = @[@"a",@"e",@"i",@"o",@"u"]; | |
BOOL isFirstLetterVowel = NO; | |
for (NSString *vowel in vowels){ | |
if ([vowel isEqualToString:firstLetter]) { | |
isFirstLetterVowel = YES; | |
break; |