Swift — Apple Inc. tomonidan iOS, iPadOS, macOS, watchOS, tvOS va Linux uchun ishlab chiqilgan umumiy maqsadli, multi-paradigmali, kompilyatsiyalangan dasturlash tili. Swift Applening Cocoa va Cocoa Touch freymvorklari hamda Apple mahsulotlari uchun yozilgan mavjud Objective-C kodining katta tanasi bilan ishlash uchun moʻljallangan. U ochiq manbali LLVM kompilyator freymvorki bilan qurilgan va 2014-yilda chiqarilgan 6-versiyadan buyon Xcodega kiritilgan. Apple platformalarida[1] u C, Objective-C, C++ va Swift kodlarini bir xil dasturda ishlashga imkon beradigan Objective-C runtime kutubxonasidan foydalanadi.[2]

Swift logosi

Kodga misolTahrirlash

// Oʻzgaruvchilar
var implicitInteger = 70
var implicitDouble = 70.0
var explicitDouble: Double = 70
// Konstantlar
let numberOfApples = 3
let numberOfOranges = 5
let appleSummary = "I have \(numberOfApples) apples."
let fruitSummary = "I have \(numberOfApples + numberOfOranges) pieces of fruit."
print("Hello, world")

let people = ["Aziza": 67, "Bobur": 8, "Javlon": 33, "Salima": 25]
for (name, age) in people {
    print("\(name) is \(age) years old.")
}

ManbalarTahrirlash

  1. The Swift Linux Port. Swift.org. Apple Inc. 3-avgust, 2016.
  2. A fast look at Swift, Apple's new programming language. Ars Technica. Condé Nast (5-iyun, 2014). 6-iyun, 2014.

HavolalarTahrirlash