Swift programming language for beginners

Good morning !


Is Swift programming language easy to learn for beginners ? I have some programming skills, but I want to learn Swift. Do you recommend it as first language ? What tutorials do you recommend for beginners ? And advantages for learning Swift ?


Sincerely yours,


Claudiu

Posted on Apr 11, 2022 11:41 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 12, 2022 2:33 PM

Apple presents Swift as an introductory language, and has lots of materials available to learn its capabilities. Depending on how you learn, there are websites, books, and lots of coding examples using the Playgrounds apps. The available Playgrounds examples and introductory documentation are pretty good, too.


Swift does have fairly strict typing and (helpfully) with good type inference support, as many other recent languages do. Some other programming languages are rather more... laissez-faire... about data typing. Some other languages—like Pascal—are yet stricter about data types, and with weak or no type inference support. I don't think the typing will be a hinderance particularly when you're learning, as typing point right to some of the more common sorts of coding errors. I tend to enable stricter typing and diagnostics in other languages, too—in C with Clang, enabling -Wall and potentially some other diagnostics-related switches can be helpful for spotting silly or subtle programming errors.


For macOS, you'll either need to acquire Xcode, or the command-line tools, or—best for starting out with Swift on Mac, and for starting out with programming more generally—the Swift Playgrounds app from the Mac App Store, and also the Playgrounds app for iPad and iPhone.


Xcode, the command-line tools, and Playgrounds apps are all from Apple, and all are free.


I use both Xcode and Playgrounds for app-related work. Playgrounds is handy for testing and prototyping code, and is lighter and simpler than is Xcode. Playgrounds is fully capable of developing, debugging, and publishing apps, too. And Playgrounds is a good way to learn Swift, without also having to learn Xcode or the command line at the same time.


Swift is heavily tied to Apple platforms, though it is open source, and there are Swift ports for other platforms including for Ubuntu and Centos Linux, and for Windows 10. Swift is increasingly prevalent on macOS, iPadOS, iOS, and other Apple platforms, but it's much less commonly used on other platforms.


C# is arguably an analog to Apple's Objective C language, and is commonly used for development targeting Microsoft platforms. C# usually isn't presented as an introductory programming language.


Oracle Java is akin to modern COBOL and with what I'd consider a strong everything-and-the-kitchen-sink design model. It runs pretty almost everywhere. Oracle Java is not available on iOS nor iPadOS. Some schools do teach Oracle Java as an introductory language. You'll need to download Java from Oracle for macOS. Do be cautious about the Oracle Java software licenses involved with what you do install, as one of the major Oracle Java components you'll necessarily be installing is available either as open-source (OpenJDK) or as a commercially licensed product (Oracle JDK).


If you're interested in learning about development for Apple platforms including for iPhone, iPad, and Mac hardware, and you're currently considering Swift, C#, and Oracle Java, your choice is pretty clearly Swift.

9 replies
Question marked as Top-ranking reply

Apr 12, 2022 2:33 PM in response to ClaudiuAlex

Apple presents Swift as an introductory language, and has lots of materials available to learn its capabilities. Depending on how you learn, there are websites, books, and lots of coding examples using the Playgrounds apps. The available Playgrounds examples and introductory documentation are pretty good, too.


Swift does have fairly strict typing and (helpfully) with good type inference support, as many other recent languages do. Some other programming languages are rather more... laissez-faire... about data typing. Some other languages—like Pascal—are yet stricter about data types, and with weak or no type inference support. I don't think the typing will be a hinderance particularly when you're learning, as typing point right to some of the more common sorts of coding errors. I tend to enable stricter typing and diagnostics in other languages, too—in C with Clang, enabling -Wall and potentially some other diagnostics-related switches can be helpful for spotting silly or subtle programming errors.


For macOS, you'll either need to acquire Xcode, or the command-line tools, or—best for starting out with Swift on Mac, and for starting out with programming more generally—the Swift Playgrounds app from the Mac App Store, and also the Playgrounds app for iPad and iPhone.


Xcode, the command-line tools, and Playgrounds apps are all from Apple, and all are free.


I use both Xcode and Playgrounds for app-related work. Playgrounds is handy for testing and prototyping code, and is lighter and simpler than is Xcode. Playgrounds is fully capable of developing, debugging, and publishing apps, too. And Playgrounds is a good way to learn Swift, without also having to learn Xcode or the command line at the same time.


Swift is heavily tied to Apple platforms, though it is open source, and there are Swift ports for other platforms including for Ubuntu and Centos Linux, and for Windows 10. Swift is increasingly prevalent on macOS, iPadOS, iOS, and other Apple platforms, but it's much less commonly used on other platforms.


C# is arguably an analog to Apple's Objective C language, and is commonly used for development targeting Microsoft platforms. C# usually isn't presented as an introductory programming language.


Oracle Java is akin to modern COBOL and with what I'd consider a strong everything-and-the-kitchen-sink design model. It runs pretty almost everywhere. Oracle Java is not available on iOS nor iPadOS. Some schools do teach Oracle Java as an introductory language. You'll need to download Java from Oracle for macOS. Do be cautious about the Oracle Java software licenses involved with what you do install, as one of the major Oracle Java components you'll necessarily be installing is available either as open-source (OpenJDK) or as a commercially licensed product (Oracle JDK).


If you're interested in learning about development for Apple platforms including for iPhone, iPad, and Mac hardware, and you're currently considering Swift, C#, and Oracle Java, your choice is pretty clearly Swift.

Apr 12, 2022 10:19 AM in response to ClaudiuAlex

At present, Swift is not native on macOS without installing Xcode and/or the command line tools for Xcode and a compatible version of macOS for either of those. Swift is a highly typed language that will make you work for its learning curve. See:


Swift - Apple Developer and do click the View Resources link at the bottom of that page for more Swift related content. The current Big Nerd Ranch book will help with that learning process with their Swift Programming book. That book covers Swift v5.3 and Xcode 12.



Apr 13, 2022 7:39 AM in response to ClaudiuAlex

C# for web applications ties those apps to Microsoft Windows, much as writing in Swift ties apps to Apple platforms and to nearby.


There’s lots of stuff called “web apps”, too. That can range from Python and Django or Flash or such, to Apache Tomcat (and all that based on Java), to JavaScript apps from simple to those built on node.js or Electron, and CGI scripts written in anything from Fortran to COBOL to Lua to Zig, and a whole lot more. (It’s entirely possible to boot Linux within a web browser, for instance.)


If web apps are interesting to you, I’d start with learning more about HTTP and how it really works (via telnet into TCP port 80, etc), about GET and POST and encodings and REST—how the web actually works—and then about HTML and CSS, then JavaScript and/or WebAssembly, some basics of IP networking and DNS and TLS (as those are always tangled in here somewhere), and only then about then about the frameworks and other programming languages. Starting at C# is skipping ahead, and doesn’t provide much of a foundation for your understanding. Oh, there’s usually some database knowledge mixed in here too, as most web apps will access a database of some sort.


Swift too can be used on a server. https://www.swift.org/server/


There’s always some new programming language or language update to learn, some new framework or technology or platform, it just never ends. And it’s far more than any one person can ever learn… Get going, learn the basics of programming, and then maybe about other common paradigms (imperative/procedural/message-passing designs being among the most common), and build your knowledge and skills from there.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Swift programming language for beginners

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.