Swift 5.2 Official Documentation

Learning Swift PL these days to make an app and release it immediately, I have, as I believe most people, an app idea to make a million of dollars, but the problem is, as of today, one must know Swift programming language to make it happen (if one, of course, doesn’t have immediate access to VCs money to hire iOS engineers).

Swift’s official documentation page is the first destination to wrap up the main ideology and its techniques to learn a bit about this language, for example:

protocol ExampleProtocol {
    var simpleDescription: String { get }
    mutating func adjust()
}

“A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality.” 

class SimpleClass: ExampleProtocol {
    var simpleDescription: String = "A very simple class."
    var anotherProperty: Int = 69105
    func adjust() {
        simpleDescription += "  Now 100% adjusted."
    }
}
var a = SimpleClass()
a.adjust()
let aDescription = a.simpleDescription

struct SimpleStructure: ExampleProtocol {
    var simpleDescription: String = "A simple structure"
    mutating func adjust() {
        simpleDescription += " (adjusted)"
    }
}
var b = SimpleStructure()
b.adjust()
let bDescription = b.simpleDescription

As you can see, the problem with all these chunk of codes is that they are so abstract you must act (I don’t know how) to find a real life example usage of it on your own. Most people smart, but there are, who can’t grasp such an abstract ideas immediately, they need something to copy “right now from some freely available repository” and use it on production.

May be it is because I forgot how to use my own brain, and I engrained the idea of plagiarism so deeply that I need all these ready-to-go recipes now and immediately. It seems to be this is not how the World works nowadays, right?

struct SimpleStructure: ExampleProtocol {
    var simpleDescription: String = "A simple structure"
    mutating func adjust() {
        simpleDescription += " (adjusted)"
    }
}

We have struct type that’s called SimpleStructure and it has ExampleProtocal type we have “created” earlier. What does this code do? How can I use this code in my real life? Why I need a SimpleDescription? Just for the sake to describe my Protocol? Why? What am I adjusting and why adjusting at all? And another zillion of questions I must find before even create the first page of my app that is going to make a billionaire.

P.S. Of course I will find all the answers to my questions, this post will be just a simple reminder with a simple description to… Something like that.

This entry was posted in Programming. Bookmark the permalink.

Leave a Reply