LaunchArgumentWithMultipleValues
public protocol LaunchArgumentWithMultipleValues : LaunchArgument, ExpressibleByArrayLiteral
Protocol that should be implemented by types representing launch argument that accepts collection of values.
Example:
struct MagicNumbers: LaunchArgumentWithMultipleValues {
struct Number: LaunchArgumentValue {
var value: String {
return "\(number)"
}
let number: Int
}
let key = "MagicNumbers"
let values: [Number]
public init(_ values: [Number]) {
self.values = values
}
}
Usage:
let app = XCUIApplication()
TestLauncher(options: [
MagicNumbers([.init(number: 5), .init(number: 7)])
]).configure(app).launch()
Handling:
let magicNumbers = UserDefaults.standard.stringArray(forKey: "MagicNumbers")
-
LaunchArgumentValue
holds a set of requirements for the values a launch arguments can hold.Declaration
Swift
associatedtype Value : LaunchArgumentValue
-
Array of values associated to the launch argument.
Declaration
Swift
var values: [Value] { get }
-
Initializes object with given array of valeus.
Declaration
Swift
init(_ values: [Value])
-
launchArguments
Extension methodDefault formatted representation of the launch argument.
Declaration
Swift
public var launchArguments: [String]? { get }
-
init(arrayLiteral:)
Extension methodInitializes launch argument with a list.
Declaration
Swift
public init(arrayLiteral elements: Value...)
Parameters
elements
list of values.