ios-taipei / events

A repo to launch iOS@Taipei meetup events.
20 stars 1 forks source link

2021/02/09 » SwiftUI view basics live demo #8

Open kuotinyen opened 3 years ago

kuotinyen commented 3 years ago

Description:

Live coding to show basic SwiftUI View and layout way.

Google Meet:

https://meet.google.com/hjy-jmmk-wzi

kuotinyen commented 3 years ago

Q:How to make proportion Spacer in SwiftUI like Flutter flex? A:Maybe can use double Spacer to make its length 2x.

kuotinyen commented 3 years ago

Q:Will ScrollView + LazyVStack cause cell reuse performance issue? A:Unknown.

kuotinyen commented 3 years ago

Q:How to refactor with Router? A:https://stackoverflow.com/questions/61304700/swiftui-how-to-avoid-navigation-hardcoded-into-the-view

kuotinyen commented 3 years ago

Q:How to solve NavigationLink destination pre-initialize performance issue? A:Wrap the view in LazyView() to make destination lazy.

struct LazyView<Content: View>: View {
    let build: () -> Content
    init(_ build: @autoclosure @escaping () -> Content) {
        self.build = build
    }
    var body: Content {
        build()
    }
}
kuotinyen commented 3 years ago

Repository: https://github.com/kuotinyen/ios-taipei