All Projects → AkkeyLab → StoryboardPreviewsBySwiftUI

AkkeyLab / StoryboardPreviewsBySwiftUI

Licence: MIT License
Introduce how to make the Storyboard file and Xib file correspond to the preview function by SwiftUI.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to StoryboardPreviewsBySwiftUI

Swiftwebui
A demo implementation of SwiftUI for the Web
Stars: ✭ 3,663 (+10365.71%)
Mutual labels:  swiftui, swift5, swiftui-example
iOS-SwiftUI-Firebase-Login-Example
Complete Sign up and Sign in Process for iOS SwiftUI - using Firebase Email and Password Authentication.
Stars: ✭ 37 (+5.71%)
Mutual labels:  swiftui, swift5, swiftui-example
SwiftUIDemo
A demo app showing you how to build a table view and navigation interface with SwiftUI
Stars: ✭ 26 (-25.71%)
Mutual labels:  swiftui, swift5, swiftui-example
SwiftUI-App
This swiftUI Demo is very simple & easy to understand. This swiftUI demo includes On-boarding screens, login screen, forgot password screen, sign up screen, home & logout.
Stars: ✭ 175 (+400%)
Mutual labels:  swiftui, swift5, swiftui-example
NYTimes-iOS
🗽 NY Times is an Minimal News 🗞 iOS app 📱 built to describe the use of SwiftSoup and CoreData with SwiftUI🔥
Stars: ✭ 152 (+334.29%)
Mutual labels:  swiftui, swift5, swiftui-example
RRSettingsKit
A beautiful customizable settings screen created in SwiftUI
Stars: ✭ 118 (+237.14%)
Mutual labels:  xcode11, swiftui, swiftui-example
TinyRage
Flappy Bird for WatchOS 6+ written in swift 5 using spriteKit
Stars: ✭ 23 (-34.29%)
Mutual labels:  xcode11, swift5
Tasky
Tasky is a task management app made with SwiftUI.
Stars: ✭ 22 (-37.14%)
Mutual labels:  swiftui, swiftui-example
aprenda-swift
Uma lista de conteúdos para você aprender Swift
Stars: ✭ 429 (+1125.71%)
Mutual labels:  swiftui, swift5
OnlySwitch
⚙️ All-in-One menu bar app, hide 💻MacBook Pro's notch, dark mode, AirPods, Shortcuts
Stars: ✭ 1,288 (+3580%)
Mutual labels:  swiftui, swift5
tca-swiftui-navigation-demo
Demo project that shows how to implement navigation in SwiftUI iOS application using Swift Composable Architecture
Stars: ✭ 75 (+114.29%)
Mutual labels:  swiftui, swiftui-example
SwiftUI-Currency-Converter
Currency Converter project coded by SwiftUI and Swift5
Stars: ✭ 56 (+60%)
Mutual labels:  swiftui, swift5
BarChart
SwiftUI Bar Chart
Stars: ✭ 156 (+345.71%)
Mutual labels:  swiftui, swiftui-example
SwiftUIRealtimeShoppingCart
SwiftUI Collaborative Shopping Cart with Firestore Database
Stars: ✭ 34 (-2.86%)
Mutual labels:  swiftui, swiftui-example
SwiftUI.TextEdit
SwiftUI proof-of-concept text edit component
Stars: ✭ 71 (+102.86%)
Mutual labels:  swiftui, swiftui-example
GameKitUI.swift
GameKit (GameCenter) for SwiftUI
Stars: ✭ 29 (-17.14%)
Mutual labels:  swiftui, swift5
SwiftUI-learning
SwiftUI视频教程配套代码(SwiftUI+SwiftUI 2.0+SwiftUI 3.0)+SwiftUI macOS+其他
Stars: ✭ 57 (+62.86%)
Mutual labels:  swiftui, swiftui-example
Shift
Light-weight EventKit wrapper.
Stars: ✭ 31 (-11.43%)
Mutual labels:  swiftui, swift5
Swipeable-View
Simple editActionsForRowAt functionality, written on SWIFTUI
Stars: ✭ 37 (+5.71%)
Mutual labels:  swiftui, swift5
ACarousel
A carousel view for SwiftUI | SwiftUI 旋转木马效果
Stars: ✭ 124 (+254.29%)
Mutual labels:  swiftui, swift5
image

Sample of Preview function by SwiftUI

Introduce how to make the Storyboard file and Xib file correspond to the preview function by SwiftUI.
You can use SwiftUI preview feature while continuing to support iOS 13 and below!!

Usage

In order to try the preview feature, you need to select a preview-only target. That's because the target version needs to be iOS 13 or more for the preview feature to work.
The swift file described for previews is linked to "preview-only target" only.
If you change the parameter for UIView or UIViewController inside updateUIView method, it will be reflected in the preview.

image
import SwiftUI
import UIKit

#if DEBUG
// Create new for preview
struct UserDetailBasicInfoCellPreviews: PreviewProvider {
    static var previews: some View {
        Group {
            // Sets the format of the preview
            UserDetailBasicInfoCell()
                .previewLayout(.fixed(width: 320, height: 100))
                .previewDevice(PreviewDevice(rawValue: "iPhone SE"))
            UserDetailBasicInfoCell()
                .previewLayout(.fixed(width: 414, height: 100))
                .previewDevice(PreviewDevice(rawValue: "iPhone XS Max"))
        }
    }

    static var platform: PreviewPlatform? = .iOS
}

// UserDetailBasicInfoCell.swift
// UserDetailBasicInfoCell.xib
extension UserDetailBasicInfoCell: UIViewRepresentable {
    typealias UIViewType = UserDetailBasicInfoCell

    func makeUIView(context: Context) -> UserDetailBasicInfoCell {
        return Self.instantiate()
    }

    func updateUIView(_ uiView: UserDetailBasicInfoCell, context: Context) {
        // Make parameter change for preview
    }
}
#endif

Let's try!

There is a layout bug in this sample. Fix bugs quickly using this review feature!

Before After

Information

This is using the actual product. Some images have been replaced with dummy data.

License

StoryboardPreviewsBySwiftUI is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].