[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6531":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":27,"discoverSource":28},6531,"swift-corelibs-foundation","swiftlang\u002Fswift-corelibs-foundation","swiftlang","The Foundation Project, providing core utilities, internationalization, and OS independence","swift.org",null,"C",5433,1179,300,612,0,2,9,40.22,"Apache License 2.0",false,"main",[],"2026-06-12 02:01:26","# Foundation\n\nThe 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.\n\nIt is designed with these goals in mind:\n\n* Provide a small set of basic utility classes and data structures.\n* Make software development easier by introducing consistent conventions.\n* Support internationalization and localization, to make software accessible to users around the world.\n* Provide a level of OS independence, to enhance portability.\n\nThere is more information on the Foundation framework [here](https:\u002F\u002Fdeveloper.apple.com\u002Flibrary\u002Fmac\u002Fdocumentation\u002FCocoa\u002FReference\u002FFoundation\u002FObjC_classic\u002F).\n\nThis 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.\n\n## Project Navigator\n\nFoundation builds in different configurations and is composed of several projects.\n\n```mermaid\n  graph TD;\n      FF[Foundation.framework]-->SF\n      subgraph GitHub\n        SCLF[swift-corelibs-foundation]-->SF\n        SF[swift-foundation]-->FICU[swift-foundation-icu]\n        SF-->SC[swift-collections]\n      end   \n```\n\n### Swift Foundation\n\nA 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.\n\n_swift-foundation_ depends on a limited set of packages, primarily [swift-collections](http:\u002F\u002Fgithub.com\u002Fapple\u002Fswift-collections) and [swift-syntax](http:\u002F\u002Fgithub.com\u002Fapple\u002Fswift-syntax).\n\n### Swift Corelibs Foundation\n\nA 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.\n\n_swift-corelibs-foundation_ builds for non-Darwin platforms only. It installs the `Foundation` umbrella module, `FoundationXML`, and `FoundationNetworking`.\n\n### Foundation ICU\n\nA 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.\n\n### Foundation Framework\n\nA [framework](https:\u002F\u002Fdeveloper.apple.com\u002Flibrary\u002Farchive\u002Fdocumentation\u002FMacOSX\u002FConceptual\u002FBPFrameworks\u002FFrameworks.html) 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.\n\n\n## Using Foundation\n\nHere is a simple `main.swift` file which uses Foundation. This guide assumes you have already installed a version of the latest [Swift binary distribution](https:\u002F\u002Fswift.org\u002Fdownload\u002F#latest-development-snapshots).\n\n```swift\nimport Foundation\n\n\u002F\u002F Make a URLComponents instance\nlet swifty = URLComponents(string: \"https:\u002F\u002Fswift.org\")!\n\n\u002F\u002F Print something useful about the URL\nprint(\"\\(swifty.host!)\")\n\n\u002F\u002F Output: \"swift.org\"\n```\n\nYou will want to use the [Swift Package Manager](https:\u002F\u002Fswift.org\u002Fpackage-manager\u002F) to build your Swift apps.\n\n## Working on Foundation\n\nswift-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.\n\nswift-corelibs-foundation also builds as part of the toolchain for non-Darwin platforms. Instructions on building the toolchain are available in the [Swift project](https:\u002F\u002Fgithub.com\u002Fswiftlang\u002Fswift?tab=readme-ov-file#building).\n\n### Building swift-corelibs-foundation on Windows\n\nWhen 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\u002Fcurl\u002Flibxml 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:\n\n```\ncmake -G Ninja -B \u003Cbuild folder> -DFOUNDATION_SWIFTPM_DEPS=YES\ncmake --build \u003Cbuild folder> --target --target WindowsSwiftPMDependencies\n```\n\nAfter running these commands, the output will include a list of environment variables to set. After setting these environment variables, you can run `swift test`\u002F`swift build` just like on Linux in order to build swift-corelibs-foundation with an existing Swift toolchain.\n\n## Contributions\n\nWe welcome contributions to Foundation! Please see the [known issues](Docs\u002FIssues.md) page if you are looking for an area where we need help. We are also standing by on the [mailing lists](https:\u002F\u002Fswift.org\u002Fcommunity\u002F#communication) to answer questions about what is most important to do and what we will accept into the project.\n","该项目是Swift编程语言的核心库之一，旨在为几乎所有应用程序提供基础功能支持。它主要提供了基本的实用类和数据结构，遵循一致的编程规范以简化软件开发过程，并支持国际化与本地化，使软件能够适应全球用户的需求。此外，它还致力于实现一定程度的操作系统独立性，从而增强程序的可移植性。`swift-corelibs-foundation`特别适用于那些缺乏Objective-C运行时环境但需要使用Foundation API的平台。对于macOS、iOS等苹果操作系统，则推荐直接采用系统自带的Foundation库。此项目通过C和Swift编写，不仅包含了如URL处理、数据编码\u002F解码等功能，还集成了诸如日期时间管理、字符串格式化等国际化的关键组件，非常适合跨平台或非苹果生态下的Swift应用开发。","2026-06-11 03:07:29","top_language"]