Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

v-i-s-h-a-l v-i-s-h-a-l

👨‍💻
View GitHub Profile
@v-i-s-h-a-l
v-i-s-h-a-l / SwiftUIPreviewDevice
Last active Sep 15, 2020
In SwiftUI with "hot reloading" a view can be previewed alongside editing code. The preview device(s) can be controlled by providing the device name in the PreviewProvider confirming struct. This is the list of all the device names.
View SwiftUIPreviewDevice
/// Source: https://developer.apple.com/documentation/swiftui/securefield/3289399-previewdevice#discussion
/// The above document lacks updates (at the time of writing this code)
/// Some additional devices have been added in this lis
// Please, feel free to fork/comment/contribute:
// https://gist.github.com/v-i-s-h-a-l/ffd070a79125766ef4add19bb5b247cd
/// 7th revision: with suggestion from @jayrhynas (twitter)
import SwiftUI
You can’t perform that action at this time.