In love with Swift!
Some days ago I began to work with Swift, the new programming language of Apple, and iOS! Some people even said that I betrayed the movement! LOL! Really, I feel a little sad to let the open source projects in background for a time but for other side I am really motivated to work with new things and learn new technologies.
Swift is a mix of the best of programming languages, she have tuples, dictionaries, nested functions and little new concepts like optionals! I am really enjoying learning a lot with my new tech friends and really liking the new spirit of innovation that surrounds here.
Some basic tips of Swift:
-
Variables are generic but you also can put his value type.
-
You need ‘let’ or ‘var’ to declare one variable. let something: String = “This is a immutable string” var somethingOther = “This is a muttable string”
-
Enums can be almost anything not just only numbers.
-
Cases in switch can do amazing things like compare if value is some value type or another.
-
Default parameters in functions are awesome like in Python!
-
Doing for-loops are very fun! for i in 1..<someVariable.count { makeWhatYouNeed() }
-
Lazy properties are crazy and useful private var someNasty: String var usefulThing:String { get { return someNasty } set { someNasty = usefulThing } }
It’s easy create some fun to a nerdy guy! For the first time in my life, I have to thank to Apple for this!