MovieSwiftUI have been upgraded to the latest SwiftUI features, so you'll need a beta version of Xcode 12 in order to build & run it.
MovieSwiftUI is an application that uses the MovieDB API and is built with SwiftUI. It demos some SwiftUI (& Combine) concepts. The goal is to make a real world application using SwiftUI only. It'll be updated with new features as they come to the SwiftUI framework.
這是我用來練習的APP 主要分為幾個階段
MVVM
ScrollView 裡添加 GeometryReader ScrollViewReader 會導致scrollview無法滾動 目前猜測事GeometryReader造成ScrollView無法正常計算ContentView
withAnimation連續呼叫會造成動畫重複
ScrollView(.horizontal){
GeometryReader(){ geometry in
ScrollViewReader(content: { proxy in
HStack{
ForEach(0..<5) {i in
Text("\(i)")
.frame(width: 320,height:400)
.id(i)
.foregroundColor(.white)
}
}.onChange(of: menuIndex) { target in
print(menuIndex)
withAnimation {
proxy.scrollTo(menuIndex)
}
}
})
}
}
ScrollView GeometryReader ScrollViewReader 還不太熟 Grid item的部分
TopMenu 可再優化