Skip to content

Commit

Permalink
[snapshot] Replace Objective-C-style NSMakeRange with Swift-style NSR…
Browse files Browse the repository at this point in the history
…ange.init (#15128)

* Replace Objective-C-style NSMakeRange with Swift-style NSRange.init

Replace Objective-C-style NSMakeRange(0, simulator.count) with Swift-style NSRange(location: 0, length: simulator.count) (suggested by SwiftLint https://github.com/realm/SwiftLint). Delete empty line.

* Increment SnapshotHelperVersion to 1.21
  • Loading branch information
RomanPodymov authored and janpio committed Aug 6, 2019
1 parent d7e02e4 commit d1b7d85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions snapshot/lib/assets/SnapshotHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ open class Snapshot: NSObject {

let screenshot = XCUIScreen.main.screenshot()
guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }

do {
// The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices
let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ")
let range = NSMakeRange(0, simulator.count)
let range = NSRange(location: 0, length: simulator.count)
simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "")

let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")
Expand Down Expand Up @@ -300,4 +300,4 @@ private extension CGFloat {

// Please don't remove the lines below
// They are used to detect outdated configuration files
// SnapshotHelperVersion [1.20]
// SnapshotHelperVersion [1.21]

0 comments on commit d1b7d85

Please sign in to comment.