Skip to content

Instantly share code, notes, and snippets.

@KaneCheshire
Created July 8, 2018 19:08
Show Gist options
  • Save KaneCheshire/4b871955d78b4b13a64a6867792561ef to your computer and use it in GitHub Desktop.
Save KaneCheshire/4b871955d78b4b13a64a6867792561ef to your computer and use it in GitHub Desktop.
struct Step {
@discardableResult
init(I handler: () -> Void) {
runActivity(for: handler)
}
@discardableResult
init(I handler: @autoclosure () -> Void) {
runActivity(for: handler)
}
private func runActivity(for handler: () -> Void) {
let activityName = // Somehow turn the handler into a descriptive string for the activity name
XCTContext.runActivity(named: activityName) { _ in
handler()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment