~/talk

Using C Libraries in Swift 3

Talkat 360iDev 2017 · 2017-08-13..08-16· [swift]
links:none on file
slides:none on file

Builds a working Swift 3 wrapper around an existing C library and shows the exact steps that make it work: create module maps to expose headers, call C functions and map structs and pointers to UnsafePointer/UnsafeBufferPointer, convert String <-> C by utf8 and null termination, manage ownership and lifetimes, and pass Swift closures through C callbacks via Unmanaged/opaque context pointers. Demo compiles, prepares statements, binds values, reads results from a decades‑long weather DB and plots a surprising ~350 days/year with essentially no snow.

AI-written summary · about

  1. 0:00Intro
  2. 1:06Advantages of C
  3. 2:19Modules
  4. 2:59Module maps
  5. 4:03One module map per SDK
  6. 4:48No expectation of privacy
  7. 8:47C functions
  8. 9:32C Structs
  9. 11:20UnsafeBufferPointer
  10. 14:29C Strings in Swift
  11. 14:49Swift strings
  12. 23:47Ownership
  13. 27:02Re-binding memory
  14. 27:52Memory layout
  15. 30:18Prefer ARC!
  16. 33:25Context pointers
  17. 40:23Resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.