News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Swift Programming language

Started by NiveRoshni, Aug 07, 2020, 01:26 PM

Previous topic - Next topic

NiveRoshni

Swift is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. for iOS, iPadOS, macOS, watchOS, tvOS, and Linux. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products.

Stable release: 5.2.4 / May 20, 2020; 2 months ago

Preview release: 5.3 branch

Typing discipline: Static, strong, inferred

First appeared: June 2, 2014; 6 years ago

OS: macOS, Darwin, Linux, Windows, Android

License: Apache License 2.0 (Swift 2.2 and later); Proprietary (up to Swift 2.2)

About Swift

Swift is a fantastic way to write software, whether it's for phones, desktops, servers, or anything else that runs code. It's a safe, fast, and interactive programming language that combines the best in modern language thinking with wisdom from the wider Apple engineering culture and the diverse contributions from its open-source community. The compiler is optimized for performance and the language is optimized for development, without compromising on either.

Swift is friendly to new programmers. It's an industrial-quality programming language that's as expressive and enjoyable as a scripting language. Writing Swift code in a playground lets you experiment with code and see the results immediately, without the overhead of building and running an app.

Swift defines away large classes of common programming errors by adopting modern programming patterns:

*Variables are always initialized before use.

*Array indices are checked for out-of-bounds errors.

*Integers are checked for overflow.

*Optionals ensure that nil values are handled explicitly.

*Memory is managed automatically.

*Error handling allows controlled recovery from unexpected failures.

Swift code is compiled and optimized to get the most out of modern hardware. The syntax and standard library have been designed based on the guiding principle that the obvious way to write your code should also perform the best. Its combination of safety and speed make Swift an excellent choice for everything from "Hello, world!" to an entire operating system.

Swift combines powerful type inference and pattern matching with a modern, lightweight syntax, allowing complex ideas to be expressed in a clear and concise manner. As a result, code is not just easier to write, but easier to read and maintain as well.

Swift has been years in the making, and it continues to evolve with new features and capabilities. Our goals for Swift are ambitious. We can't wait to see what you create with it.

Version Compatibility

This book describes Swift 5.3, the default version of Swift that's included in Xcode 12. You can use Xcode 12 to build targets that are written in either Swift 5.3, Swift 4.2, or Swift 4.

When you use Xcode 12 to build Swift 4 and Swift 4.2 code, most Swift 5.3 functionality is available. That said, the following changes are available only to code that uses Swift 5.3 or later:

*Functions that return an opaque type require the Swift 5.1 runtime.

*The try? expression doesn't introduce an extra level of optionality to expressions that already return optionals.

*Large integer literal initialization expressions are inferred to be of the correct integer type. For example, UInt64(0xffff_ffff_ffff_ffff) evaluates to the correct value rather than overflowing.

A target written in Swift 5.3 can depend on a target that's written in Swift 4.2 or Swift 4, and vice versa. This means, if you have a large project that's divided into multiple frameworks, you can migrate your code from Swift 4 to Swift 5.3 one framework at a time.