DEV Community

Aaron Castillo
Aaron Castillo

Posted on

Swift Beginnings: A New Language Journey

Origin
My journey with Swift began around two weeks ago. While many of my peers are immersing themselves in Python and Java to develop complex databases, I’ve chosen to focus on Swift to create an engaging iPhone game. I chose this path because I wanted to build something that resonates with a broad audience, not just other programmers. My goal is to craft a game that people find enjoyable and would want to revisit during their free time.

However, I’ve encountered a challenge: Swift isn’t as widely used as some other languages. According to the TIOBE Index, Swift ranks 12th in popularity among programming languages in 2024. As a result, I find myself relying more heavily on documentation and resources than I might with more popular languages. Despite this, I’m excited about the potential to create something both fun and accessible.

What is Swift?
Swift is an open-source programming language developed by Apple for building iOS, macOS, watchOS, tvOS, and beyond applications. It was first introduced at Apple's Worldwide Developers Conference (WWDC) in 2014.

The programming language I’m most comfortable with is JavaScript. My experience with JavaScript has provided me with a solid understanding of programming fundamentals, which has proven to be very beneficial as I begin learning Swift. Given this strong foundation, I expected Swift to be relatively straightforward, and I was right!
However, I’ve discovered that while Swift shares many core programming concepts with JavaScript, there are some notable nuances and differences worth mentioning. For instance, Swift’s syntax and type system are different from JavaScript. Swift is a statically typed language, meaning that types are checked at compile-time, which contrasts with JavaScript's dynamic typing. This shift requires a different approach to handling variables and functions, and understanding these nuances has been an important part of my learning process.
Also, Swift's stress on safety and performance introduces new concepts and practices, such as optionals, value types, and memory management, which are less prominent in JavaScript. These features are designed to enhance code reliability and efficiency, but they also involve a shift in mindset compared to what I’m used to.
Overall, while transitioning from JavaScript to Swift involves navigating some unique challenges, my background in programming has made the process manageable and even enjoyable. I look forward to continuing to explore and master Swift, appreciating how its distinct features contribute to building robust and efficient applications.

In JS, a constant variable is declared starting with const and regular variable with let.
In Swift, a constant variable is declared with let and a regular variable with var.

In JS, there is no type safety unless you're using TypeScript.
In Swift, there is type safety built-in. (but it's optional of course)

Looking Forward
As I continue learning Swift, I’m planning to dive into SpriteKit, a framework designed for 2D game development. SpriteKit simplifies creating games by providing built-in tools for handling sprites, animations, and physics. With SpriteKit, I can easily add and animate game elements, simulate realistic interactions like collisions and gravity, and create effects such as explosions and smoke.
The framework also integrates well with Apple’s technologies, including Metal for advanced graphics rendering. By exploring SpriteKit, I aim to develop engaging games that leverage Swift’s capabilities and take advantage of the powerful features provided by the Apple ecosystem.

Tips For Picking Up a New Coding Language
For those embarking on the journey of learning Swift or any new programming language, leveraging your existing programming knowledge can significantly ease the transition.
If you’re coming from a language like JavaScript, focus on understanding the unique aspects of the new language, such as Swift’s static typing and safety features.
Take advantage of the built-in tools and frameworks offered by the language, like SpriteKit for game development in Swift, to build practical projects that solidify your understanding.
Experiment with features specific to the new language, and integrate with related technologies, such as Metal for graphics in Swift, to gain deeper insights and hands-on experience.
Embrace the learning curve with patience and curiosity, and remember that each language has its own set of nuances that, once mastered, will enhance your overall programming proficiency.

Thanks for reading! Check back in for my next blog as I continue my journey learning Swift!

Top comments (0)