Swift Programming Language Tutorial Part 4 (Classes)

Best viewed in 4k!
Leave comments on any errata
Classes 0:00
Special Thanks to Logan @ loganwright.io


Kadin Sayani says:

can you run the code in a playground completely?

Kadin Sayani says:

is cgrect a rectangle?

Dex_Max says:

Why would you use a class when you can use a struct? And what in the world was class func?

Coşkun Güngör says:

Hi Skip Wilson. Very good tutorial. Thanks

Kamrul Hasan says:

Please keep going on ……….Since we are new in this Language……….Great job

NeopolitianNPLTN says:

Keep up the great work! Your tutorials are the best, as others have said. Perfect speed and clarity for multiple viewings too. (I’m sloooooww!)

Lily Mirar says:

Thanks so much for making this channel it’s so useful! But I just don’t understand the difference between a ‘class func’ and a function you make inside a class. Is there a reason to use either of them over the other?

Олег Токмачев says:

thanks man! very good job! very clear explanations!

A Mao says:

Following the tutorial example, we can identify 2 “John”, one is person and another is mutant. Please note that init external name is the part of func signature. the “override” in Mutant init() is needed.
class Person {
    var name: String
    init(name:String) {
        self.name = name
    func showBeing()->String {
        return “Human”
class Mutant: Person {
    override init(name:String) {
        super.init(name: name)
    override func showBeing()->String {

var beings:[Person] = [Person(name: “John”), Mutant(name: “John”)]
for (index, value) in enumerate(beings) {
    println(“(index): (value.showBeing())”)

marc B says:

Excellent! So much Clarity . thank you very much Skip

TLR91 says:

another great video…

hamza shaikh says:

you explained in a way i finally understand classes. classes thank you

A Mao says:

This is a great tutorial. The following is my feedback related to Swift dynamic binding (run-time) through the inheritance.
class A {
    var a:Int
    func c()->String {
        return “A”
    init(a: Int) {
        self.a = a
class B: A {
    var b: Int
    override func c()->String {
      return “B”
    init(a:Int, b:Int) {
        self.b = b
        super.init(a: a)

var arrayClass:[A] = [A(a: 11),B(a: 1, b: 2),A(a: 22),B(a: 3, b: 4)]
for (index, value) in enumerate(arrayClass) {
    println(“(index) (value.c())”)

Cody Romano says:

I want you to make a separate tutorial all about Janet, the mutant who teleports and also sings. 

Mohammed Habeeb says:

Great Tutorial…. Really with detail explanation 
looking forward for more video like this 

Thanks for sharing here with the efforts you make

Yixin Pang says:

I don’t understand that why a “let” number type Simpleclass can be modified by using dotted method. Can anyone explain to me?

Ben Berman says:

You lost 12% battery while you made this video.

Anthony Rosamilia says:

Did you just say Janet Jackson’s nick name could be the Bramaniac? Funny.

Karljürgen Feuerherm says:

Interesting tutorials, thanks. Are any files for the series available for download anywhere (in particular for the moment the .png files) so one can easily work along?

Leonard Jonathan Oh says:

at 16:40 while defining:
class SimpleClassTwo {
    var rect:CGRect = CGRect(x: 0.0, y: 0.0, width: 100, height: 1000)  //struct as property of class

i get an error: use of undeclared type ‘CGRect’

on XCode Beta 3, imported Cocoa framework. 
And under Utitlities > File Inspector settings are:
Type: Default – swift playground,
Playground Settings platform: OS X

So what could be wrong?

Melissa Gonzalez says:

your awesome

Nihad ELIYEV says:

Excelent tutorial. Thanks for sharing

tanmaya patra says:

Can you Please give me the link for downloading “Apple OS X iso” download link ? not torrent. I need Direct download link..
Thanks in Advance.

Alex Laird says:

This is the best class tutorial I’ve seen and been able to understand – thank you!

Henry Moran says:

Hi Skip

If you could please clarify why you would want to initialize the properties separately as apposed to initializing them in the same line that would be great. Or why you would want to do it one way over the other?

Here’s some example code for reference:

class tipCaculatorOne {
    let total: Int
    let taxPct: Int
    init(total: Int, taxPct: Int) {
        self.total = total
        self.taxPct = taxPct

class tipCaculatorTwo {
    let total: Int = 2
    let taxPct: Int = 2

Florence Luvr says:

Good tutorial but really difficult to see the small text.

baljinder singh says:

Excellent tutorial, Thanks for making it available for free.

YoLninYo says:

Best Swift tutorial series on Youtube right now bar none! Congratulations! You are an excellent teacher sire! 

tonyrosam says:

Thank You for this information Skip.

Nicholas Sheehan says:

at 5:30 it is showing your results in the right panel of the screen. On my screen, it is just saying person. what am i doing wrong?

Fidjjd Fjdjdjddj says:

Why are you assigning the nickname string to nil?

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!