(?:")((?:.|\n)*?)(?<!\\)(?:")
The first group will be the string itself. Escaped quotes are ignored.
| struct Selectables<Data, ID: Hashable, Content>: View where Content: View { | |
| let data: [Data] | |
| @Binding var selectedIds: [ID] | |
| let id: KeyPath<Data, ID> | |
| let content: (Data, Binding<Bool>) -> Content | |
| init(_ data: [Data], selectedIds: Binding<[ID]>, id: KeyPath<Data, ID>, @ViewBuilder content: @escaping (Data, Binding<Bool>) -> Content) { | |
| self.data = data | |
| self._selectedIds = selectedIds | |
| self.id = id |
| extension Result where Failure == ParseError { | |
| func checkError(messageIfNotError: String, type: ParseErrorType) { | |
| switch self { | |
| case .success(_): | |
| XCTFail(messageIfNotError) | |
| case let .failure(error): | |
| if error.type != type { | |
| XCTFail("Should have thrown \(type.rawValue) but did \(error.type)") | |
| } | |
| } |
| struct AlertAction { | |
| let title: String | |
| var role: ButtonRole? = .none | |
| let action: (() -> Void) | |
| } | |
| struct AlertItem { | |
| let title: String | |
| let message: String | |
| let actions: [AlertAction] |
| import Foundation | |
| import SwiftUI | |
| struct AlertButton: Identifiable { | |
| var id: String { | |
| title | |
| } | |
| let title: String | |
| let style: ButtonRole? |
| struct RgxResult { | |
| private let textCheckingResult: NSTextCheckingResult | |
| private let baseString: String | |
| init(_ result: NSTextCheckingResult, _ baseString: String) { | |
| self.textCheckingResult = result | |
| self.baseString = baseString | |
| } | |
| } |
| import Cocoa | |
| import RxSwift | |
| import RxCocoa | |
| infix operator <-> | |
| func <-> <T>(property: ControlProperty<T>, variable: BehaviorRelay<T>) -> Disposable { | |
| let bindToUIDisposable = variable.asObservable() | |
| .bind(to: property) |
| extension String { | |
| func localize() -> String { | |
| return NSLocalizedString(self, comment: "") | |
| } | |
| func localize(_ args: CVarArg...) -> String { | |
| return String(format: NSLocalizedString(self, comment: ""), args) | |
| } | |
| } |
| extension String { | |
| func substring(from: UInt, length: UInt) -> String { | |
| if Int(from) >= self.characters.count { | |
| preconditionFailure("from is out of bounds.") | |
| } | |
| if Int(from+length) > self.characters.count { | |
| preconditionFailure("from and lenght are out of bounds") | |
| } | |
| let startIndex = self.index(self.startIndex, offsetBy: String.IndexDistance(from)) |