HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
swiftlang
swift-corelibs-foundation
C2015–2025
swiftlang / swift-corelibs-foundation

swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence

36Distinct people
40Mentions
0Explicit recommenders
5.4KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

The Foundation Project, providing core utilities, internationalization, and OS independence

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 4:01:40 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year40 dated mentions

Observed mentions: 2015-12-03 22:31:05 UTC to 2025-12-24 21:10:16 UTC.

024682015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC211
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC808
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC505
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC404
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC202
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC312
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC505
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC505
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC202
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 12, 2026.

Read the project’s introduction
Foundation The Foundation framework defines a base layer of functionality that is required for almost all applications. It provides primitive classes and introduces several paradigms that define functionality not provided by either the Objective-C runtime and language or Swift standard library and language. It is designed with these goals in mind: Provide a small set of basic utility classes and data structures. Make software development easier by introducing consistent conventions. Support internationalization and localization, to make software accessible to users around the world. Provide a level of OS independence, to enhance portability. There is more information on the Foundation framework here. This project, swift-corelibs-foundation, provides a compatibility implementation of the Foundation API for platforms where there is no Objective-C runtime. On macOS, iOS, and other Apple platforms, apps should use the Foundation that comes with the operating system. Project Navigator Foundation builds in different configurations and is composed of several projects. graph TD; FF[Foundation.framework]-->SF subgraph GitHub SCLF[swift-corelibs-foundation]-->SF SF[swift-foundation]-->FICU[swift-foundation-icu] SF-->SC[swift-collections] end Loading Swift Foundation A shared library shipped in the Swift toolchain, written in Swift. It provides the core implementation of many key types, including URL, Data, JSONDecoder, Locale, Calendar, and more in the FoundationEssentials and FoundationInternationalization modules. Its source code is shared across all platforms. swift-foundation depends on a limited set of packages, primarily swift-collections and swift-syntax. Swift Corelibs Foundation A shared library shipped in the Swift toolchain. It provides compatibility API for clients that need pre-Swift API from Foundation. It is written in Swift and C. It provides, among other types, NSObject, class-based data structures, NSFormatter, and NSKeyedArchiver. It re-exports the FoundationEssentials and FoundationInternationalization modules, allowing compatibility for source written before the introduction of the swift-foundation project. As these implementations are distinct from those written in Objective-C, the compatibility is best-effort only. swift-corelibs-foundation builds for non-Darwin platforms only. It installs the Foundation umbrella module, FoundationXML, and FoundationNetworking. Foundation ICU A private library for Foundation, wrapping ICU. Using a standard version of ICU provides stability in the behavior of our internationalization API, and consistency with the latest releases on Darwin platforms. It is imported from the FoundationInternationalization module only. Clients that do not need API that relies upon the data provided by ICU can import FoundationEssentials instead. Foundation Framework A framework built into macOS, iOS, and all other Darwin platforms. It is written in a combination of C, Objective-C, and Swift. The Foundation framework compiles the sources from swift-foundation into its binary and provides one Foundation module that contains all features. Using Foundation Here is a simple main.swift file which uses Foundation. This guide assumes you have already installed a version of the latest Swift binary distribution. import Foundation // Make a URLComponents instance let swifty = URLComponents(string: "https://swift.org")! // Print something useful about the URL print("\(swifty.host!)") // Output: "swift.org" You will want to use the Swift Package Manager to build your Swift apps. Working on Foundation swift-corelibs-foundation builds as a standalone project using Swift Package Manager. Simply use swift build in the root of the checkout to build the project. swift-corelibs-foundation also builds as part of the toolchain for non-Darwin platforms. Instructions on building the toolchain are available in the Swift project. Building swift-corelibs-foundation on Windows When building Foundation as a standalone project, it requires you to provide some dependencies that it will link during the build. SwiftPM already fetches most of these dependencies and on Linux the remaining dependencies (dispatch, zlib, curl, libxml) are found in the Swift toolchain or on the host OS. However, Windows does not ship with zlib/curl/libxml on the host OS. In order to build swift-corelibs-foundation as a package on Windows, you must first checkout and build these dependenies before running swift build as recommended above. To do this, you can build the provided CMake target which (instead of building Foundation via CMake) will checkout and build these 3 dependencies via CMake and provide environment variables that will connect the SwiftPM build to these dependencies. To build these targets, run the following commands: cmake -G Ninja -B <build folder> -DFOUNDATION_SWIFTPM_DEPS=YES cmake --build <build folder> --target --target WindowsSwiftPMDependencies After running these commands, the output will include a list of environment variables to set. After setting these environment variables, you can run swift test/swift build just like on Linux in order to build swift-corelibs-foundation with an existing Swift toolchain. Contributions We welcome contributions to Foundation! Please see the known issues page if you are looking for an area where we need help. We are also standing by on the mailing lists to answer questions about what is most important to do and what we will accept into the project.
Read the full README on GitHub

What Hacker News says

4 sources
Swift on Linux, which is the key to "server side" swift, is really coming along. However, it still has several rough edges that, while they can be worked around, mar the experience and probably discourage a lot of casual tinkerers who try it. For instance, if you download the Swift 4.1 tarball, uncompress it, and start up the REPL, it doesn't really work. The first thing you will do is probably "import Foundation" (because the Swift standard library is really minimal, so Foundation is where most of the interesting stuff is). Then the REPL will complain: error: repl.swift:1:8: error: missing required module 'CoreFoundation' You'd have to hunt on the Swift bug tracker[1] to figure out that's a packaging problem on Linux, and to fix it you have to do something like: sudo chmod a+r /opt/swift/usr/lib/swift/CoreFoundation/* Then, say
Read the rest
you make a toy program, and try to debug it using lldb. That might seem to work, but as soon as you stop at a breakpoint and try to print a value, booom! lldb will spit a wall of error text at you. (This assumes your program imports Foundation, again, but almost every program will.) This is also work-aroundable, as long as you are able to find the JIRA ticket thread describing how to work around it[2]. There are a bunch of little issues like this, that make it clear that Linux isn't yet a first-class platform for Swift. All this stuff is gonna work fine on your Mac. OTOH though, the Foundation library itself has made amazing, amazing progress. It's super useful, mostly finished[3], and its pretty clear when stuff that works on Apple platforms isn't yet ready on Linux (because those bits use NSUnimplemented() which just crashes the program). That's important because without Foundation, which contains a lot of the basic building blocks for programs, Swift won't be competing with Go or Rust. Swift Package Manager is also fully cross-platform and awesome. Apple also recently released an interesting low-level cross-platform asynchronous event-driven network application framework, called swift-nio[4]. This is super-interesting, but also causes more churn; for instance, once swift-nio was released, the team behind the most popular Swift web application framework, Vapor[5], started frantically rewriting their v3 release to leverage it. So... yeah, I would say "server side Swift" is becoming less niche, but... it's still pretty niche. On Linux, it's far less mature than Go or Rust, and you need to expect to have to bing[6] a bunch of annoying little issues to get things working. [1]: https://bugs.swift.org/browse/SR-2783 [2]: https://bugs.swift.org/browse/SR-7065 [3]: https://github.com/apple/swift-corelibs-foundation/blob/mast... [4]: https://github.com/apple/swift-nio [5]: https://vapor.codes [6]: just joking! haha ;-D
In Swift 4.1 Released
Yes, and there has been for a while now. However, (as you might already know, since you chose the NSURLSession example), it's not 100% feature-complete when compared to the macOS or iOS version. Here's one example of where you have to do (or at least, I had to do on 2017-07-12) #if !os(Linux) to account for platform differences: https://github.com/soracom/soracom-sdk-swift/blob/master/Sou... You will encounter that kind of thing from time to time if you use Swift and Foundation on Linux. Still, the Foundation library is highly usable on Linux, and is vastly ahead of where I expected they would be by now when they announced it. But there are still some things that are not implemented. They actually do have a good status page about this topic specifically: https://github.com/apple/swift-corelibs-foundation/blob/mast...
In What's new in Swift 4.1

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.