Xcode: Which device is simulator running? Comparing views across devices with FBSnapshotTestCase and Nimble-Snapshot

114 Views Asked by At

I am currently using FBSnapshotTestCase and Nimble-Snapshot to take snapshots of ViewControllers in my project.

I know in the Realm UI and Snapshot Testing Video Luis mentioned that we can test views across devices (iPhone5 vs iPhone 6+ etc).

I want to know which device I am running on within simulator, but when I print out the model name using this extension found at this post iOS: How to determine the current iPhone/device model in Swift?
let modelName = UIDevice.current.modelName

It would just say I am running in Simulator.

I was following this Stack Overflow post How to determine the device running in the simulator? but using FBSnapshotTestCase is not necessarily related to "functionalities available". Has anyone ran into a similar problem?

1

There are 1 best solutions below

0
On

Looks like UIDevice.current.name will give you what you're looking for when it comes to the simulator. (However, on a device it will instead be what the owner has named their device in the settings).