Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Toni77777/PreviewDevice
PreviewDevice - is a library with type-safe syntax sugar for preview device on SwiftUI. Preview for UIKit and Cocoa.
https://github.com/Toni77777/PreviewDevice
apple cocoa cocoapods ios ios13 ios15 iphone13 maccatalyst macos osx preivew-device spm swift swift-package-manager swiftui tvos uikit watchos xcode xcode13
Last synced: about 1 month ago
JSON representation
PreviewDevice - is a library with type-safe syntax sugar for preview device on SwiftUI. Preview for UIKit and Cocoa.
- Host: GitHub
- URL: https://github.com/Toni77777/PreviewDevice
- Owner: Toni77777
- License: mit
- Created: 2021-08-21T20:31:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-02T20:26:25.000Z (about 2 months ago)
- Last Synced: 2024-11-08T20:47:19.275Z (about 1 month ago)
- Topics: apple, cocoa, cocoapods, ios, ios13, ios15, iphone13, maccatalyst, macos, osx, preivew-device, spm, swift, swift-package-manager, swiftui, tvos, uikit, watchos, xcode, xcode13
- Language: Swift
- Homepage:
- Size: 323 KB
- Stars: 50
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-swiftui-libraries - PreviewDevice - PreviewDevice - library with elegant syntax for Preview Device in SwiftUI (Preview / Content)
README
# PreviewDevice
![Platforms](https://img.shields.io/cocoapods/p/PreviewDevice)
[![Version](https://img.shields.io/cocoapods/v/PreviewDevice.svg?style=flat)](https://cocoapods.org/pods/PreviewDevice)
![SPM](https://img.shields.io/badge/Swift_Package_Manager-compatible-success?style=flat)
![Xcode](https://img.shields.io/badge/Xcode-13-blueviolet)
[![Twitter](https://img.shields.io/badge/twitter-%20%40Toni777772-blue)](https://twitter.com/Toni777772)## Requirements
* Dev environment: Xcode 13+, macOS 12+
* iOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+## Usage
Example:
```swift
import PreviewDevicestruct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.previewDevice(device: .iphone13, colorSchemes: ColorScheme.allCases)
}
}
```Result
### Preview on device
```swift
.previewDevice(device: .iphone12)
```### Preview on devices
```swift
.previewDevices(device: [.iphone8, .iphone11Pro .iphone12, .iphone12ProMax])
```### Preview on device with color scheme (light, dark)
```swift
.previewDevice(device: .iphone12, colorScheme: .light)
```### Preview on device with ColorSchemes
```swift
.previewDevice(device: .iphone12, colorScheme: [.light, .dark])
```### Preview on device with orientation (InterfaceOrientation)
```swift
.previewDevice(device: .iphone12, orientation: .portrait)
```### Preview on device with orientations
```swift
.previewDevice(device: .iphone12, orientations: [.portrait, .landscapeLeft, .landscapeRight])
```### Preview on device with orientation and color schemes
```swift
.previewDevice(device: .iphone12, orientation: .portrait, colorSchemes: [.light, .dark])
```## Installation
### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
Specify next line in Podfile:```ruby
pod PreviewDevice
```### [Swift Package Manager](https://github.com/apple/swift-package-manager)
Open Xcode, File -> Swift Packages -> Add Packages.. and paste library git url:
```
https://github.com/Toni77777/PreviewDevice.git
```## Articles
[Meet PreviewDevice 0.7.0](https://dev.to/toni777772/meet-previewdevice-0-7-0-1dpg)[What's new in PreviewDevice 0.8.0](https://dev.to/toni777772/what-s-new-in-previewdevice-0-8-0-5dc0)
## License
PreviewDevice is released under the MIT license.