https://github.com/donggyushin/dgpreview
Make UIKit project enable preview feature of SwiftUI
https://github.com/donggyushin/dgpreview
preview previewer swift
Last synced: 11 months ago
JSON representation
Make UIKit project enable preview feature of SwiftUI
- Host: GitHub
- URL: https://github.com/donggyushin/dgpreview
- Owner: donggyushin
- License: mit
- Created: 2022-02-13T08:01:23.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-13T08:46:55.000Z (over 4 years ago)
- Last Synced: 2024-12-11T17:50:27.625Z (over 1 year ago)
- Topics: preview, previewer, swift
- Language: Swift
- Homepage:
- Size: 10.7 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DGPreview
Make UIKit project enable preview feature of SwiftUI

## Requirements
- iOS 13 +
- Swift 5 +
- Xcode 13 +
## Installaction
### SPM
```
File > Add Packages > https://github.com/donggyushin/DGPreview
```
### CocoaPod
```
pod 'DGPreview', :git => 'https://github.com/donggyushin/DGPreview'
```
## Usage
### UIView
```
import SwiftUI
import DGPreview
struct MyButtonPreview: PreviewProvider {
static var previews: some View {
DGPreview {
return MyButton()
}.previewLayout(.sizeThatFits)
}
}
```
### UIViewController
```
import SwiftUI
import DGPreview
struct ViewControllerPreview: PreviewProvider {
static var previews: some View {
ViewController().showDGPreview(.iPhone13Pro)
}
}
```