A Swift Experience: The Basics (Part 1 of 2)
Truth be told, I have been an avid user of Apple gadgets since 2012. I own an iPod Touch, iPad, iPhone, Apple Watch, and a MacBook Pro laptop. I love the feel of those gadgets and I also like how fast and efficient they respond to my inputs. Not to mention, using Apple gadgets means I will be less likely to deal with viruses and anything similar to that that will harm my gadgets to the extent that they become hard to internally and externally repair. Beyond that, I cared less. I was simply satisfied with what I knew. But one day, I had a major wake-up call.
By random chance, I stumbled upon a TED Talk video on YouTube featuring a popular YouTuber/IT executive Carlo Ople. He basically stressed the need for people to create more and consume less with the things they like and love. In my case, that meant having to literally create things with the use of my MacBook Pro laptop. One of the fancy things I thought about creating was a software program on a certain platform. A few days and a hundred internet links later, I was introduced to developing mobile applications, specifically the ones downloaded on an iPhone.
One of the ways to develop a mobile application on iPhone is through the use of the Swift programming language. This open-sourced language combines small elements from different programming languages such as Objective-C, Rust, Haskell, Ruby, Python, C#, and CLU. Developed in 2010 and launched in 2014 by Apple, this programming language evolved to be an IT industry standard when it comes to developing digital applications for Apple gadgets. This means that Swift can be shown on iOS, macOS, watchOS, and tvOS devices. During the last few years, this language also became available and runnable on a machine that has Ubuntu, CentOS, Amazon Linux, or Windows 10 as the main operating system.
Once I discovered Swift, I made an immediate commitment to learn the language, especially that I am about to apply for IT opportunities once I graduate a few months from now. The more experiences to bring to the table, the better. Having some experience in Swift would also help me develop a deeper and hopefully more innate insight on designing things with respect to the User Experience and User Interface (UX/UI) principles.
With that said, today, I am proud to share my journey and teach you all the basics of the Swift programming language. I will thoroughly discuss the following:
- The programming language’s features and drawbacks
- Setting up the development environments on a Macintosh operating system
- Discussing the basic ideas and how to deal with those ideas
From there, I will also demonstrate how to work around the Swift language in the most basic way possible. Come with me as we explore the wonderful world of the Swift programming language. I hope I make it easy, valuable, and interesting enough for you folks reading this article. We will have two parts of getting to know the Swift language. Let us have a general point of view first and then make it more specific as we learn more.
Let us go and learn.
Swift’s Features and Drawbacks
- While software development codes generally look intimidating, the Swift language is an exception. It looks clean and readable to the point that learning how to work around the language would be as easy as counting from one to three. This means building code will take less time and task scaling would be easier unlike in other programming languages.
- Aside from that, the language runs fast, which means speed is not an issue.
- Swift is also securely safe to work and manage when needed, handles code bugs with care, takes up as little memory on the development virtual machine as possible, and is open-sourced to the extent that everybody gets to work with it for free and that a lot of third-party tools can complement the programming language as well.
- Finally, the language syntax is set to near to natural English, which means learning to code in Swift by only relying on common sense will suffice. There is no need to learn technical English, which is, honestly, intimidating.
- Despite the Swift language’s emergence as an IT industry standard, it has its major issues, too. First, its seven years of existence means it is still considered a “young” technology, which means a lot maturing still needs to be done for the language to be as useful as and as prominent as other programming languages such as Java, C, and Python.
- Second, due to its age, the number of users coding in Swift is less than those that are using the more established programming languages like those listed above.
- Most of all, there are not enough fully-reliable software programs that enable the workability of codes written in Swift language. The closest and only software program that meets all the needs of the language is XCode. What is even worse is that XCode is only available on Apple computers. There are factually other software programs that can manage Swift codes but they only manage a few aspects. Fortunately, there is still a chance that those programs would be as good, if not better than XCode in the future. When all is said and done, Swift being “new in the industry” is an issue, but it can easily be fixed.
Swift’s Installation on Apple Macintosh
To start with learning how to make a mobile application through the use of the Swift programming language, I would recommend doing so on an Apple Macintosh operating system. Fortunately for me, I already have a 2019 16-inch MacBook Pro. I will do all of my demonstrations on that machine.
The software program we will work with is XCode. It has everything we need to play around Swift code and build mobile applications.
First picture will be the Input, while the second picture will be the Output.
Basic comment and print statement.
Let (to make a constant) and Var (to make a variable). Result is a printed calculation. And look at the comment. Now that’s another way to do that.
Basic function with code header.
Basic array with a For loop.
Here is a visual aid to practice principles related to the Swift programming language. I will demonstrate the setup and how to code. Two more codes will be shown and one of them will be codedon the fly.
On XCode, I would recommend that you use the Swift Playground instead of setting the project to be in iOS. That way, it would be easy and convenient.
Congratulations! You have finished the first part. That means you are now proficient in the basics of the Swift programming language.
For the second and final part, we will dig deep into the world of mobile application development. We will actually build an iOS application on XCode. Expect visualized and detailed demonstrations from me as I will discuss how to I coded and ran the project well. I will also tackle theories associated with advances Swift and XCode, along with mobile applications in general. The process on building my mobile application, the approaches I embraced to make this mobile application a reality, and my attempt to deploy it as an actual, free mobile application available on the Apple App Store will be on the next post as well.
If there is a chance, I will also demonstrate how to install a Macintosh virtual machine on a Windows-based computer. So far, I have downloaded a few virtual machines on my Windows laptop (a Dell Latitude 5000, for those who are curious) but most of them have earlier versions of the Macintosh operating system. And with XCode, you must download it on the latest version or you will never download it at all.
That is all for now. If you have an issue related to the Swift programming language, feel free to comment on this blog post.
In closing, it is time to Swift Up! Stay safe, healthy, chill, and happy. Until next time, folks. Thank you for reading.
For more information on how to master the Swift programming language, here are some of the links I recommend you check:
- Comprehensive Guide to the Swift Programming Language
- Basic Guide to the Swift Programming Language
- Simple Online Swift Language Editor and Compiler
- Comprehensive Guide to XCode
- Downloading Without An Apple Account on a Macintosh Computer