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
// Source: https://medium.com/@anthony.prokuda/how-to-locate-and-wait-for-an-element-in-xcuitest-a-powerful-approach-105b81628986 | |
extension NSPredicate { | |
static func keyPath<T, U>( | |
_ keyPath: KeyPath<T, U>, | |
is type: NSComparisonPredicate.Operator = .equalTo, | |
value: U, | |
modifier: NSComparisonPredicate.Modifier = .direct, | |
options: NSComparisonPredicate.Options = [] | |
) -> NSPredicate { |
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
// Source: https://medium.com/@anthony.prokuda/how-to-locate-and-wait-for-an-element-in-xcuitest-a-powerful-approach-105b81628986 | |
extension XCUIElement { | |
func wait<U>( | |
attribute keyPath: KeyPath<XCUIElement, U>, | |
is comparisonOperator: NSComparisonPredicate.Operator, | |
value: U, | |
timeout: TimeInterval = 10 | |
) -> XCUIElement? { | |
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 Combine | |
import Foundation | |
enum PublisherExpectationError: Error { | |
case failedWithError(Error) | |
case finishedWithoutMatchingValue | |
case timedOut | |
} | |
public extension Publisher { |
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 Combine | |
import Foundation | |
public extension Publisher { | |
func expect(performing action: @escaping () async -> Void, fulfills condition: @escaping (Output) -> Bool, timeout: TimeInterval) async -> Bool { | |
let publisher = self | |
.handleEvents(receiveSubscription: { _ in | |
Task { | |
await action() |
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
# ====================================================== | |
# Config File for User-defined InstantMappings | |
# ====================================================== | |
[Globals] | |
# The primary MIDI channel that the controller uses in | |
# the range of 0-15. | |
GlobalChannel: 0 | |
InputName: reface CP | |
OutputName: reface CP |
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
# Ensure simulator is started before copying to grant access to folder (otherwise the target path remains read-only) | |
echo "Starting simulator (UUID=$TARGET_DEVICE_IDENTIFIER)..." | |
xcrun simctl boot $TARGET_DEVICE_IDENTIFIER; open -a Simulator | |
xcrun simctl bootstatus $TARGET_DEVICE_IDENTIFIER | |
FILES_PATH="$(xcrun simctl listapps $TARGET_DEVICE_IDENTIFIER | grep LocalStorage | awk -F'"' '{print $4}' | sed -e "s/^file:\/\///")/File Provider Storage" | |
INPUT_FOLDER="$SRCROOT/E2ETests/Resources/File Provider Storage"; | |
echo "Copying File Provider Storage files to simulator..."; | |
# Using rsync to skip copying hidden files |
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
// https://developer.apple.com/wwdc20/10168 | |
let statisticsLogger = Logger (subsystem: "com.example.Fruta", category: "statistics") | |
// Log statistics about communication with a server. | |
func logStatistics(taskID: UUID, giftCardID: String, serverID: Int, seconds: Double) { | |
statisticsLogger.log("\(taskID) \(giftCardID, align: .left(columns: GiftCard.maxIDLength)) \(serverID) \(seconds, format: .fixed(precision: 2))") | |
} |
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
func customLog(_ category: String) -> OSLog { | |
#if DEBUG | |
return OSLog(subsystem: Bundle.main.bundleIdentifier!, category: category) | |
#else | |
return OSLog.disabled | |
#endif | |
} |
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
// Zalgo text: https://en.wikipedia.org/wiki/Zalgo_text | |
func zalgo(_ string: String, intensity: Int = 5) -> String { | |
let combiningDiacriticMarks = 0x0300...0x036f | |
let latinAlphabetUppercase = 0x0041...0x005a | |
let latinAlphabetLowercase = 0x0061...0x007a | |
var output: [UnicodeScalar] = [] | |
for scalar in string.unicodeScalars { | |
output.append(scalar) | |
guard (latinAlphabetUppercase).contains(numericCast(scalar.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
# Safely clean up SwiftUI Preview data located in: | |
# ~/Library/Developer/Xcode/UserData/Previews | |
xcrun simctl --set previews delete all |
NewerOlder