Translation Swift Core Libraries/swift Library

Source: Internet
Author: User

Original: Swift Core Libraries

Swift Core Library

The Swift Core Library project provides features that are more superficial than standard libraries, which provide powerful tools that can be used on all swift platforms. The core library is designed to provide stable and functional functionality in the following important areas.

    • Common types, including data, URL, character set (character sets) and specialized collections
    • Unit Test
    • Networking Primitives
    • Scheduling and execution of work, including multi-threading, queues and reminders
    • Persistence, including property lists, archives, JSON parsing and XML parsing
    • Support for date-time calculations
    • Abstraction of System features
    • Interaction with the file system
    • internationalization, including date, number formatting and language files (anguage-specific resources)
    • User preference Settings
Project status

The core library is part of the future Swift 3 release. It is not ready to be used in the product. In fact, it is still in its early stages of development. We decided to use the core library as part of the initial open source code to work with the community from the start. The Mailing list page has details on how to join the collaboration.

Writing all of these features from scratch is a huge project, so we decided to quickly start the core library project by taking advantage of the work that has already been done. In particular, reuse of three existing libraries ( Foundation , libdispatch , XCTest .) And as many implementations as possible (implementation).

Foundation

The foundation framework defines the basic functionality that almost all apps need (a base layer of functionality). It provides a simple class that the language itself does not provide with the runtime and introduces some specifications that define the functionality. It has the following objectives:

    • Provides a small collection of public classes
    • Make software development easy by introducing conventions
    • Support internationalization and localization to enable software to be used by users around the world
    • Provides a level of dependency on the operating system to enhance portability

For more information on the foundation framework, see this: from Apple ' s documentation. The swift.org version of the Foundation framework leverages many of the same underlying libraries (such as ICU and corefoundation) as Apple implementations, but is completely independent of the OBJECTIVE-C runtime so it is a major implementation of the same API. Cover pure Swift code on top of the underlying library. For more information, see this: GitHub project page.

An example of a foundation on GitHub:

Using Foundation

This is a simple Main.swift file that uses the foundation. This tutorial assumes that you have installed the latest version of the Swift release.

Import foundation//Create a urlcomponents instance let Swifty = Nsurlcomponents (string: "https://swift.org")!//output some information print ("\ ( swifty.host!) ") Output: "Swift.org"

****

Libdispatch

Grand Central Dispatch (GCD or Libdispatch) provides comprehensive support for multicore hardware.

Libdispatch can now be used on all Darwin platforms. The goal of the project is to provide a modern version of Libdispatch available on all swift platforms. To achieve this goal, we will use the existing open source C language implementation to implement as many portable subsets of the API as possible (portable subset).

For more information on the Linux version of Libdispatch, see this: GitHub project page.

Xctest

The Xctest library provides a common Swift unit testing framework designed for SWIFT package (Swift packages) and Swiftapp.

This version of Xctest uses the same API that you are familiar with xctest from Xcode. Our goal is to enable you to run your project's tests on all swift platforms without rewriting the code.

For more information on the Linux version of Xctest, see this: GitHub project page.

****

This article is mainly for the translator for personal reference, the language is not very fluent, welcome to put forward comments in this regard. At the same time, because the translator's level is limited, the article may have the omission and the improper place, also welcome correction.

****

Translation Swift Core Libraries/swift Library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.