These Frequently Asked Questions are for those starting to learn [Swift](https://www.swift.org/). As I start my journey I have a lot of questions. I'm documenting those here from the perspective of someone who has been programming for a long time in Python and has worked in other languages when needed (e.g. bash, Groovy, Go, PowerShell, etc.). [TOC] # What is Swift language, standard library, and Foundation? [Swift language](https://www.swift.org/about/) Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns. [Standard library](https://www.swift.org/documentation/#standard-library) The Swift standard library defines a base layer of functionality for writing Swift programs. [Foundation](https://developer.apple.com/documentation/foundation) ([Foundation Project](https://github.com/apple/swift-corelibs-foundation)) is a framework. The Foundation framework defines a base layer of functionality that is required for almost all applications. It provides primitive classes and introduces several paradigms that define functionality not provided by either the Objective-C runtime and language or Swift standard library and language. Think of these three things as layers. The language is the first layer just like any other language, say Python or Go. The standard library is the next layer which provides common functionality. Next layer is Foundation. As far as I understood it, what is for example the standard library in Python is divided into standard library and Foundation in Swift. From [this answer](https://stackoverflow.com/a/62120096) I take it that there is a legacy of macOS and Objective-C that is bridged with the new world of an open source, multi-platform Swift language. Foundation has two implementations, one for Apple platforms (think of it as _native_ Foundation) and one for non-Apple platforms (think of it as _cross-platform_ Foundation). Both should provide the same functionality but are targetted to different use cases. Listen to [Where is Swift headed in 2022?](https://www.swiftbysundell.com/podcast/113/) for more information on the relationship of these three. # Do I need to learn SwiftUI or UIKit to learn Swift? I think the answer is: No. Swift is a language and ecosystem (see above) which is not limited to building apps for Apple platforms. It's a general purpose language and the community is working hard to make it usable in many scenarios. When building apps for Apple platforms (iOS, macOS, etc.) you must use SwiftUI (or UIKit, if you desire). Unfortunately, when searching for tutorials and guides on Swift, the vast majority of results are about building apps. If, like me, you want to learn Swift first (and maybe build some toy tools), those guides are the wrong place to start. I am still searching for good guides to help a backend programmer get started with using Swift to solve real life solutions. # What is Dispatch? Dispatch, also known as Grand Central Dispatch (GCD), contains language features, runtime libraries, and system enhancements that provide systemic, comprehensive improvements to the support for concurrent code execution on multicore hardware in macOS, iOS, watchOS, and tvOS. It is available on Apple platforms and Linux. Project Status A port of libdispatch to Linux has been completed. On Linux, since Swift 3, swift-corelibs-libdispatch has been included in all Swift releases and is used by other swift-corelibs projects. - [swift-corelibs-libdispatch](https://github.com/apple/swift-corelibs-libdispatch) # Can I cross-compile Swift for other platforms? It does seem possible but it appears the experience is not as smooth as what Go provides. The major reason is that the libraries (see above) you use will determine which platform your application can be built for. - [Swift on OS X compiling for Linux?](https://stackoverflow.com/a/35041695) # Can I build a single binary like in Go? It does not appear that Swift supports the same experience as Go does today. Swift can build a [statically linked binary on Linux](https://forums.swift.org/t/static-linking-on-linux-in-swift-5-3-1/41989) and work in underway to [enable static linking on Windows](https://forums.swift.org/t/enabling-static-linking-on-windows/40509/9). # Is there a library like Python requests? Foundation (see above) has networking primitives which can be used. Namely, the [URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system). The [cross-platform port](https://github.com/apple/swift-corelibs-foundation/blob/main/Docs/Status.md) may have varied implementation status for the different entity names. If I were replacing my Python scripts (that use the requests library) with Swift applications, I think I would be able to. I have not tried that yet though so I can't say how smooth the experience is. # Is there a library like Python argparse? Yes. It is called [Argument Parser](https://github.com/apple/swift-argument-parser). - [Argument Parser announcement](https://www.swift.org/blog/argument-parser/) # Is there a library like Python unittest or pytest? Yes. It is called [XCTest](https://developer.apple.com/documentation/xctest). - [swift-corelibs-xctest](https://github.com/apple/swift-corelibs-xctest) # Are there cloud SDKs? [AWS SDK for Swift](https://aws.amazon.com/sdk-for-swift/) exists today but is in Developer Preview at the time of writing. Azure has [iOS SDK](https://azure.github.io/azure-sdk/releases/latest/ios.html) but not like AWS. This is one area where Python and Go have far better support from major cloud service providers.