Swift Language Working with C and Objective-C Use the C standard library

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Swift's C interoperability allows you to use functions and types from the C standard library.

On Linux, the C standard library is exposed via the Glibc module; on Apple platforms it's called Darwin.

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
import Darwin
#elseif os(Linux)
import Glibc
#endif

// use open(), read(), and other libc features


Got any Swift Language Question?