Uncategorized

Day 13 – Protocols and Extensions

Since early on in the #100DaysOfSwiftUI @twostraws has warned us about day 13.  We didn’t know what was in day 13, but we knew it would take more than 1 hour.  Knowing this, I had a strategy for the day.  

Typically I attempt to bang out the videos, tests, and occasional checkpoints in the evening.  But today being a weekend, I worked in some video watching throughout the day.  By the evening, all that was left was protocol extensions and the checkpoint.  I even had the energy to watch https://www.hackingwithswift.com/quick-start/beginners/how-to-get-the-most-from-protocol-extensions.

I’m still here, still learning and still having fun.

protocol Person {
    var energyLevel: String { get set }
    func status()
}
extension Person {
    func status(){
        print ("My energy level is : \(energyLevel)")
    }
}
struct Programmer: Person {
    var energyLevel: String
}
var me = Programmer(energyLevel: "High")
me.status()