From the course: Make SwiftUI Playgrounds Applications
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Structs and classes - Swift Tutorial
From the course: Make SwiftUI Playgrounds Applications
Structs and classes
- [Instructor] You've made your own functions. You've learned how to declare a value for type. Now we'll tie both of those together and make your own types, which as you'll see is at the heart of Swift programming. A general rule about types is they are capitalized words in code. So let's go over here to our code and I'm going to get rid of the preview so we can have a little more space here. And you could start to see a few things. Look at this code and you'll see a lot of things that are capitalized. ContentView, View, Double, String and Text are all types, sometimes referred to as objects. And notice again ContentView, where we define a ContentView object. There's three things you should note about an object. First, an object is a group of values called properties that define that object. bannerImage, color and title are examples in the ContentView object. You'll also find a group of functions called methods that…
Contents
-
-
First steps8m 56s
-
(Locked)
Constant and calculations7m 57s
-
(Locked)
Functions, methods, and modifiers7m 14s
-
(Locked)
HStack, VStack, and layout9m 41s
-
(Locked)
Create new files and views4m 50s
-
(Locked)
Add images10m 10s
-
(Locked)
Learn about Swift types9m 32s
-
(Locked)
Variables and scope10m 33s
-
(Locked)
Using if{}else{}8m 24s
-
(Locked)
More if{}else{}12m 46s
-
(Locked)
Create custom functions7m 58s
-
(Locked)
Structs and classes10m 55s
-
Models and views10m 37s
-
-
-