Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cellular/cellular-swift
Collection of µ-frameworks and utility classes/extensions used in CELLULAR swift projects.
https://github.com/cellular/cellular-swift
cocoapods ios linux macos swift swift-package-manager tvos watchos xcode
Last synced: 2 months ago
JSON representation
Collection of µ-frameworks and utility classes/extensions used in CELLULAR swift projects.
- Host: GitHub
- URL: https://github.com/cellular/cellular-swift
- Owner: cellular
- License: mit
- Created: 2018-07-05T08:15:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-30T11:45:36.000Z (almost 5 years ago)
- Last Synced: 2024-11-13T13:43:52.714Z (2 months ago)
- Topics: cocoapods, ios, linux, macos, swift, swift-package-manager, tvos, watchos, xcode
- Language: Swift
- Homepage:
- Size: 107 KB
- Stars: 2
- Watchers: 11
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
CELLULAR
A collection of utilities that we share across swift-based projects at CELLULAR.
It is a standalone module with no external dependencies.## Features
### Codable
There are several extensions on `KeyedDecodingContainer`.
Most of which are heavily inspired by [Unbox](https://github.com/JohnSundell/Unbox).#### THE PLANET
Throughout the `Codable` examples, the following struct is used:
```swift
import CELLULARpublic struct Planet: Codable {
public var discoverer: String
public var hasRingSystem: Bool
public var numberOfMoons: Int
public var distanceFromSun: Float // 10^6 km
public var surfacePressure: Double? // bars
public var atmosphericComposition: [String]
```##### 1. Allows `Foundation` types to be inferred on value assignment
```swift
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)discoverer = try container.decode(forKey: .discoverer)
// equals: discoverer = try decode(String.self, forKey: key)hasRingSystem = try container.decode(forKey: .hasRingSystem)
// equals: hasRingSystem = try decode(Bool.self, forKey: key)numberOfMoons = try container.decode(forKey: .numberOfMoons)
// equals: numberOfMoons = try decode(Int.self, forKey: key)
distanceFromSun = try container.decode(forKey: .distanceFromSun)
// equals: distanceFromSun = try decode(Float.self, forKey: key)
```##### 2. Even `Optional` holding these types may be inferred
```swift
surfacePressure = try container.decode(forKey: .surfacePressure)
// equals: surfacePressure = try decodeIfPresent(Double.self, forKey: key)
```##### 3. Allows instances in collections to fail decoding
```swift
atmosphericComposition = try container.decode(forKey: .atmosphericComposition, allowInvalidElements: true) ?? []
}
}
```## Locking
TODO
## Storyboard
TODO
## Requirements
- iOS 11.0+ | watchOS 5.0+ | tvOS 11.0+ | macOS 10.14+ | Ubuntu 14.04+
- Swift 5.0+## Installation
### [Swift Package Manager](https://swift.org/package-manager/)
Once you have your Swift package set up, adding CELLULAR as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```swift
dependencies: [
.package(url: "https://github.com/cellular/cellular-swift.git", from: "6.0.1")
]
```### [CocoaPods](https://cocoapods.org)
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CELLULAR into your Xcode project using CocoaPods, specify it in your Podfile:
```ruby
pod 'CELLULAR'
```## License
CELLULAR is released under the MIT license. [See LICENSE](https://github.com/cellular/cellular-swift/blob/master/LICENSE) for details.