Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vmanot/simulatorkit
Programmatic access to the Simulator app.
https://github.com/vmanot/simulatorkit
Last synced: 29 days ago
JSON representation
Programmatic access to the Simulator app.
- Host: GitHub
- URL: https://github.com/vmanot/simulatorkit
- Owner: vmanot
- Created: 2021-02-22T08:36:00.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-14T19:14:59.000Z (12 months ago)
- Last Synced: 2023-11-14T20:27:31.235Z (12 months ago)
- Language: Swift
- Homepage:
- Size: 12.7 KB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SimulatorKit is a framework that wraps `CoreSimulator` and `simctl` to offer programmatic access to the Simulator app bundled with Xcode.
- macOS 11
- Swift 5.3
- Xcode 12# Installation
The preferred way of installing SimulatorKit is via the [Swift Package Manager](https://swift.org/package-manager/).
1. In Xcode, open your project and navigate to **File** → **Swift Packages** → **Add Package Dependency...**
2. Paste the repository URL (`https://github.com/vmanot/SimulatorKit`) and click **Next**.
3. For **Rules**, select **Branch** (with branch set to `master`).
4. Click **Finish**.# Why
The goal of this framework is to provide a safe and idiomatic way to control the Simulator app.
# Usage
Almost all functions on `SimulatorDevice` are synchronous, blocking and throwing.
#### List all available simulators
```swift
import SimulatorKitprint(try! SimulatorDevice.all())
```#### Boot a simulator
```swift
import SimulatorKitlet iphoneSimulator = try SimulatorDevice.all().first(where: { $0.name.contains("iPhone") })!
try iphoneSimulator.boot()
```#### Take a screenshot of a simulator
```swift
import SimulatorKitlet iphoneSimulator = try SimulatorDevice.all().first(where: { $0.name.contains("iPhone") })!
let jpgDataOfScreenshot: Data = try iphoneSimulator.screenshot()
```