From https://reactjs.org/tutorial/tutorial.html
Vivek's notes for the time being.
cmd+f TODO for pending items. this is specifically for apple watch? should probably specify that
Tutorial begins below
This tutorial doesn't assume any existing Swift knowledge.
We will build a small game during this tutorial. You might be tempted to skip it because you’re not building games — but give it a chance. The techniques you’ll learn in the tutorial are fundamental to building any React app, and mastering it will give you a deep understanding of React.
Tip |
---|
This tutorial is designed for people who prefer to learn by doing. If you prefer learning concepts from the ground up, check out our step-by-step guide. You might find this tutorial and the guide complementary to each other. |
The tutorial is divided into several sections:
- Setup for the Tutorial will give you a starting point to follow the tutorial.
- Overview will teach you the fundamentals of React: components, props, and state.
- Completing the Game will teach you the most common techniques in React development.
- Adding Time Travel will give you a deeper insight into the unique strengths of React.
You don’t have to complete all of the sections at once to get the value out of this tutorial. Try to get as far as you can — even if it’s one or two sections.
In this tutorial, we’ll show how to build an interactive tic-tac-toe game with Swift.
You can see what we’ll be building here: Final Result TODO. If the code doesn’t make sense to you, or if you are unfamiliar with the code’s syntax, don’t worry! The goal of this tutorial is to help you understand Swift and its syntax.
We recommend that you check out the tic-tac-toe game before continuing with the tutorial. One of the features that you’ll notice is that there is a numbered list to the right of the game’s board TODO a list? I guess, a second screen??. This list gives you a history of all of the moves that have occurred in the game, and it is updated as the game progresses.
You can close the tic-tac-toe game once you’re familiar with it. We’ll be starting from a simpler template in this tutorial. Our next step is to set you up so that you can start building the game.
We’ll assume that you have Xcode but you should be able to follow along even if you’re using a Hackintosh. We’ll also assume that you’re familiar with programming concepts like functions, objects, arrays, and to a lesser extent, classes.
There are probably multiple ways to complete this tutorial, but we'll assume you're using Xcode.
If you get stuck, check out the community support resources or Stack Overflow. In particular, the forum is a great way to get help quickly. If you don’t receive an answer, or if you remain stuck, please file an issue, and we’ll help you out.
Now that you're set up, let's get an overview of Swift!
Apple defines Swift as: "Swift is a powerful and intuitive programming language for iOS, iPadOS, macOS, tvOS, and watchOS. Writing Swift code is interactive and fun, the syntax is concise yet expressive, and Swift includes modern features developers love. Swift code is safe by design, yet also produces software that runs lightning-fast."
Swift lets you compose complex UIs from small and isolated pieces of code called "views".
Swift has a few different kinds of views (TODO really?), but we'll start with ContentView.View
:
// todo open a new swift project and copy that shit here