ScreenSizeSim is a lightweight Swift library that allows developers to simulate different screen sizes within their iOS apps. This tool is particularly useful for UI testing, layout adjustments, and ensuring that your app's design works seamlessly across various Apple devices.
- Simulate various iPhone and iPad screen sizes.
- Easily resize and scale the app window to match the dimensions of different devices.
- Ideal for UI testing without switching devices or simulators.
To integrate ScreenSizeSim
into your Xcode project using Swift Package Manager:
- Open your project in Xcode.
- Go to
File
->Add Packages Dependencies...
. - In the search bar, paste the repository URL:
https://github.com/ooow/ScreenSizeSim.git
. - Select the
main
branch as the version rule (if prompted). - Click "Add Package" to integrate it into your project.
You can also manually integrate ScreenSizeSim
into your project:
- Download or clone this repository.
- Drag and drop the
ScreenSizeSim
folder into your Xcode project.
To use ScreenSizeSim
, wrap your content view with the ScreenContainer
view and specify the desired screen size:
import ScreenSizeSim
ScreenContainer(DeviceScreenSize.iPhone12ProMax) {
YourContentView()
}
This will simulate the screen size of an iPhone 12 Pro Max for the wrapped content.
If you need to simulate a screen size that is not predefined, you can specify a custom size:
import ScreenSizeSim
ScreenContainer(CGSize(width: 375, height: 812)) {
YourContentView()
}
ScreenSizeSim
supports a wide range of devices, including:
- iPhone SE (1st Gen)
- iPhone 6/7/8
- iPhone X/XS/11 Pro
- iPhone 12/12 Pro/Pro Max
- iPhone 13/14/15 series
- iPad Mini, iPad Air, iPad Pro series
For a complete list of supported devices, check the DeviceScreenSizes file in this repository.
ScreenSizeSim
is licensed under the MIT License. See the LICENSE file for more information.
Contributions are welcome! If you have suggestions, bug reports, or pull requests, feel free to contribute to this repository.
Special thanks to the open-source community for their contributions and inspiration.
For any inquiries or issues, feel free to open an issue on GitHub or contact me at app@mavdew.com.
Don't forget to give it a star! ⭐️