Swift basics and testable logic to demonstrate language foundations: optionals, protocols, generics, and unit tests.
MathUtils(pure functions with tests)StringUtils(optionals, extensions)- Examples in
main.swift
Use an online Swift runner. Paste main.swift into the editor together with MathUtils and StringUtils and run. Copy output below.
== Swift Fundamentals Demo ==
Add 2+3=5
Mul 4*5=20
Mean [1,2,3]=2.0
Hello, Deepthi!
Hello, there!
If you have Swift locally:
swift build
swift test
swift run