Skip to content

Easily access SwiftUI's preview devices without having to remember or repeatedly type out the device names manually

Notifications You must be signed in to change notification settings

swillsea/EasyDevices

Repository files navigation

EasyDevices

Easily access SwiftUI's preview devices without having to remember or repeatedly type out the device names manually.

Add to your project

Follow Apple's guidelines here if you're unfamiliar with the package management system in Xcode 11+

Usage

You can use either syntax to create your devices:

static let devices = [Device.iPhoneXs, .iPhoneSE].previews
static let devices = PreviewDevice.previews(from: [.iPhoneXs, .iPhoneSE])

From there, you're good to go:

struct YourView_Previews: PreviewProvider {
     static var previews: some View {
         ForEach(devices) { device in
             // Do your device setup here
         }
     }
}

About

Easily access SwiftUI's preview devices without having to remember or repeatedly type out the device names manually

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages