iOS App Development Language
Swift is a programming language developed by Apple used to build iOS, macOS, watchOS, and tvOS apps.
import Foundation
print("Hello Swift")
var name = "Sasank" let age = 18
Int, String, Double, Bool
let age = 18
if age >= 18 {
print("Adult")
} else {
print("Minor")
}
for i in 1...5 {
print(i)
}
func add(a: Int, b: Int) -> Int {
return a + b
}
class Car {
var model: String
init(model: String) {
self.model = model
}
func drive() {
print("Car is moving")
}
}
var name: String? = "Apple"
if let unwrapped = name {
print(unwrapped)
}
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello iOS")
}
}