Giter VIP home page Giter VIP logo

swiftfoundation's Introduction

SwiftFoundation

Swift Platforms Release License Build Status Join the chat at https://gitter.im/PureSwift/SwiftFoundation

SPM compatible Carthage compatible

Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library.

Goals

  • Provide a cross-platform interface that mimics Apple's Foundation framework.
  • Provide a POSIX-based implementation for maximum portability.
  • Rewrite Foundation with Protocol-Oriented Programming principals.
  • Long-term Pure Swift replacement for the Cocoa frameworks.

Problems with Apple's Foundation

  • Objective-C - Apple's Foundation is an old API designed for Objective-C. While it works great (on Apple's platforms) and has a nice API for Objective-C programming, when imported into Swift, you can see the shortcomings of its 20+ year old API.
  • Unimplemented - The open source version of Apple's Foundation is severly lacking implementation. Most methods are marked with NSUnimplemented(). Only a small subset of Foundation based on CoreFoundation is implemented (e.g. NSArray, NSString, NSDictionary). Basic Functionality like JSON, Base64, and even HTTP requests are not implemented.
  • Portability - Since Apple's Foundation is backed by CoreFoundation, the only supported platforms are currently Linux, Darwin, and (potentially) Windows. Supporting other platforms (e.g. ARM Linux, BSD, SunOS) would require changes to the CoreFoundation codebase, written in C, which is not good for a long term Swift base library. We want all of our code to be understood by any Swift programmer.
  • Protocol Oriented Programming - Perhaps the biggest reason to use this library, is to break free from the old Object-Oriented Programming paradigms. Swift structures and protocols free you from pointers and memory management, along with bugs related to multithreaded environments. Creating structs for basic types like Date and UUID allows you to use let and var correctly. Structs also bring huge performance improvements since the compiler can perform more optimizations and doesn't have to create all the metadata needed for the Swift class runtime.

Targeted Platforms

  • LLVM Compiler
    • Darwin (OS X, iOS, WatchOS)
    • Linux

Compiling on Ubuntu

sudo apt-get install uuid-dev libjson-c-dev
swift build
.build/debug/UnitTests

Implemented

To see what parts of Foundation are implemented, just look at the unit tests. Completed functionality will be fully unit tested. Note that there is some functionality that is written as a protocol only, that will not be included on this list.

  • Base64
  • Data
  • Date
  • FileManager
  • JSON
  • Null
  • Order (equivalent to NSComparisonResult)
  • RegularExpression (POSIX, not ICU)
  • SortDescriptor
  • Thread
  • URL
  • UUID

License

This program is free software; you can redistribute it and/or modify it under the terms of the MIT License.

swiftfoundation's People

Contributors

colemancda avatar davidask avatar dwarfland avatar leberwurstsaft avatar nvzqz avatar ricardoherrera-santex avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.