Skip to content

#swift

29 posts tagged swift. All posts

  1. Mobile & AndroidPublishing a Swift package: SwiftPM, Git tags and the Swift Package IndexCreate a Swift package with SwiftPM, tag a semantic version, push it to a public Git repository, and list it on the Swift Package Index so others can depend on it.
  2. Mobile & AndroidSwift closures: syntax, capturing values, escaping and autoclosuresHow Swift closures work: the short syntax forms, trailing closures, how values are captured, @escaping, retain cycles with [weak self], and @autoclosure.
  3. Mobile & AndroidAccess control in Swift: private, fileprivate, internal, package, public and openSwift's six access levels (private, fileprivate, internal, package, public, open), what each one allows, and the defaults and rules that trip people up.
  4. Mobile & AndroidSwift memory management: ARC, reference cycles and exclusive accessHow Automatic Reference Counting frees Swift class instances, how to break reference cycles with weak and unowned, and what exclusive access and actors protect against.
  5. Mobile & AndroidUsing Alamofire, RxSwift and SwiftyJSON in a Swift projectHow to add Alamofire, RxSwift and SwiftyJSON with Swift Package Manager, with a working example of each and when Apple's built-in APIs are the better choice.
  6. Mobile & AndroidType casting in Swift: is, as, as? and as!How Swift's is, as, as? and as! operators work: upcasting, conditional and forced downcasting, casting in switch statements, and casting from Any and to protocols.
  7. Mobile & AndroidMixing Swift and Objective-C: bridging headers and the generated Swift headerHow to call Objective-C from Swift with a bridging header, call Swift from Objective-C through the generated -Swift.h header, and how types bridge.
  8. Mobile & AndroidCreating, testing and publishing a Swift package with SwiftPMCreate a Swift library with swift package init, understand the Package.swift manifest, add a dependency, build and test it, and publish versions with Git tags.
  9. Mobile & AndroidSwift concurrency basics: async/await, actors, task groups and cancellationSwift concurrency with working examples of async/await, actors, task groups, and cancellation, including a timeout helper and common gotchas.
  10. Mobile & AndroidSwift package conventions: layout, access control, tests and versioningPractical conventions for Swift packages: naming, layout, access control including package, DocC comments, tests, semantic versioning and a clean Package.swift.
  11. Mobile & AndroidSwift standard library basics: numbers, strings, collections and algorithmsA tour of Swift's standard library: integer and floating-point types, String and Character, Array, Set and Dictionary, and sorted, filter, map and reduce.
  12. Mobile & AndroidSwift for mobile apps: strengths, drawbacks and when to pick something elseThe practical pros and cons of Swift for mobile development: safety, Apple tooling, Objective-C interop, Android support, and language churn.
  13. Mobile & AndroidSwift enums: cases, associated values, raw values, and switchHow Swift enums work, covering basic cases, associated values, raw values, switch pattern matching, CaseIterable, and adding methods to an enum.
  14. Mobile & AndroidWhere Swift is heading: concurrency, server-side Swift and new platformsWhere Swift is heading beyond iOS: compile-time data-race safety, server-side frameworks, Linux, Windows, Android and WebAssembly SDKs, and what happened to Swift for TensorFlow.
  15. Mobile & AndroidContributing to an open-source Swift package: fork, test and open a pull requestFind a Swift package to work on, fork and clone it, build and test with SwiftPM or Xcode, and open a pull request that maintainers can review quickly.
  16. Mobile & AndroidUnit testing in Swift with XCTest and Swift TestingSet up a test target in Xcode, write unit tests with XCTest assertions, run them, and see the same tests written with the newer Swift Testing framework.
  17. Mobile & AndroidBuilding a first iOS app in Xcode with Swift and storyboardsCreate an iOS app project in Xcode, find your way around the workspace, connect a storyboard button and label to Swift code, then run and debug it.
  18. Mobile & AndroidSwift error handling: throws, do-catch, try?, typed throws and rethrowsHow Swift error handling works: defining Error types, throwing and propagating errors, do-catch with patterns, try? and try!, typed throws, rethrows and defer.
  19. C++ & systemsCalling C++ from Swift: native interop and Objective-C++ wrappersHow to use C++ code from Swift: direct C++ interoperability since Swift 5.9 with SwiftPM or Xcode, and the older Objective-C++ wrapper approach.
  20. Mobile & AndroidSwift performance tips: build settings, dispatch, copy-on-write and inliningSwift performance tips that hold up: build with -O and whole-module optimization, cut dynamic dispatch, use copy-on-write and inout well, and measure first.
  21. Mobile & AndroidFunctional programming in Swift with closures, map/filter/reduce, and value typesFunctional programming in Swift with closures, map/filter/reduce, function types, value-type immutability, pattern matching, and recursion, with runnable examples.
  22. Mobile & AndroidSwift generics: generic functions, generic types and constraintsHow to write generic functions and types in Swift, constrain them with protocols and where clauses, and what generics cost at runtime.
  23. Mobile & AndroidSwift extensions: adding methods, properties and protocol conformances to existing typesHow Swift extensions add methods, computed properties, initializers and protocol conformances to existing types, plus what they can't do.
  24. Mobile & AndroidSwift Package Manager basics: creating a package and managing dependenciesCreate a Swift package from the command line, add a dependency such as Alamofire to Package.swift, and update, pin or remove dependencies with SwiftPM.
  25. Mobile & AndroidDebugging Swift in Xcode: breakpoints, LLDB, logging and sanitizersHow to debug Swift code in Xcode with breakpoints, LLDB's p, po and v commands, print and Logger output, and the Address and Thread Sanitizers.
  26. Mobile & AndroidSwift basics: variables, types, control flow and functionsSwift basics for newcomers: let and var, type inference, the core value types, optionals, if, switch, loops and functions with argument labels.
  27. Mobile & AndroidSwift operators: arithmetic, bitwise, ranges and custom operatorsSwift's arithmetic, comparison, logical, bitwise, range and assignment operators, the overflow and nil-coalescing operators, and how to define a custom operator.
  28. Mobile & AndroidSwift optionals: if let, guard let, optional chaining and ??How Swift optionals represent missing values, and how to unwrap them safely with if let, guard let, optional chaining, the ?? operator and map.
  29. Mobile & AndroidSwift protocols: requirements, extensions, associated types and compositionHow to define and adopt Swift protocols, add default implementations with extensions, use associated types, inheritance and composition, and choose between some and any.

© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)