Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

hyp/swift-corelibs-foundation

 
 

Repository files navigation

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 frameworkhere.

This project,swift-corelibs-foundation, provides an 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, includingURL,Data,JSONDecoder,Locale,Calendar, and more in theFoundationEssentials andFoundationInternationalization modules. Its source code is shared across all platforms.

swift-foundation depends on a limited set of packages, primarilyswift-collections andswift-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, andNSKeyedArchiver. It re-exports theFoundationEssentials andFoundationInternationalization modules, allowing compatibility for source written before the introduction of theswift-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 theFoundation umbrella module,FoundationXML, andFoundationNetworking.

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 theFoundationInternationalization module only. Clients that do not need API that relies upon the data provided by ICU can importFoundationEssentials instead.

Foundation Framework

Aframework 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 fromswift-foundation into its binary and provides oneFoundation module that contains all features.

Using Foundation

Here is a simplemain.swift file which uses Foundation. This guide assumes you have already installed a version of the latestSwift binary distribution.

import Foundation// Make a URLComponents instanceletswifty=URLComponents(string:"https://swift.org")!// Print something useful about the URLprint("\(swifty.host!)")// Output: "swift.org"

You will want to use theSwift Package Manager to build your Swift apps.

Working on Foundation

swift-corelibs-foundation builds as a standalone project using Swift Package Manager. Simply useswift 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 theSwift project.

Contributions

We welcome contributions to Foundation! Please see theknown issues page if you are looking for an area where we need help. We are also standing by on themailing lists to answer questions about what is most important to do and what we will accept into the project.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C64.2%
  • Swift34.8%
  • Other1.0%

[8]ページ先頭

©2009-2025 Movatter.jp