SwiftUIチュートリアル

SwiftUIチュートリアル

Apple WWDC19で発表されたさいろいろな新製品やサービスで昨日は話題で持ちきりでした。
ほぼ自分たち専用。

とりあえず、本業ではないので、手間が掛からなければ良いという意味で、新しいフレームワーク「SwiftUI」が気になりましたので、公式サイトを参照一部引用させて頂きます。Swift UIチュートリアルなど。

SwiftUI

Better apps. Less code.

SwiftUI is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift. Build user interfaces for any Apple device using just one set of tools and APIs. With a declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with new Xcode design tools to keep your code and design perfectly in sync. Automatic support for Dynamic Type, Dark Mode, localization, and accessibility means your first line of SwiftUI code is already the most powerful UI code you’ve ever written.

SwiftUI Smaple Hello World Sample Code

公式サイトのリンクも貼り付けさせて頂きます。とりあえずは、公式サイトにもあります、「Hello World」「Hello SwiftUI!」を引用させて頂きます。

Hello World
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello World")
}
}
struct ContentView_Preview: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Hello SwiftUI!
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello SwiftUI!")
}
}
struct ContentView_Preview: PreviewProvider {
static var previews: some View {
ContentView()
}
}

Apple Developer
developer.apple.com
SwiftUI Tutorials
developer.apple.com/tutorials/swiftui

SwiftUI Essentials
Creating and Combining Views
This tutorial guides you through building Landmarks — an iOS app for discovering and sharing the places you love. You’ll start by building the view that shows a landmark’s details.
To lay out the views, Landmarks uses stacks to combine and layer the image and text view components. To add a map to the view, you’ll include a standard MapKit component. As you refine the view’s design, Xcode provides real-time feedback so you can see how those changes translate into code.

developer.apple.com/tutorials/swiftui/creating-and-combining-views
Swift.org
swift.org