CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✓ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Oct 2015 |
| SPMSupports SPM | ✗ |
Maintained by Ash Furrow, Gordon Fontenot.
This is a Swift microframework which implements Box<T> & MutableBox<T>, with implementations of ==/!= where T: Equatable.
Box is typically used to work around limitations of value types:
structs/enumsenums where more than one case has a valueWrapping & unwrapping a Box:
// Wrap:
let box = Box(1)
// Unwrap:
let value = box.valueChanging the value of a MutableBox:
// Mutation:
let mutableBox = MutableBox(1)
mutableBox.value = 2Building a recursive value type:
struct BinaryTree {
let value: Int
let left: Box<BinaryTree>?
let right: Box<BinaryTree>?
}Building a parameterized enum:
enum Result<T> {
case Success(Box<T>)
case Failure(NSError)
}See the sources for more details.
Add this repo as a submodule in e.g. External/Box:
git submodule add https://github.com/robrix/Box.git External/Box
Box.xcodeproj into your .xcworkspace/.xcodeproj.Box.framework to your target’s Link Binary With Libraries build phase.Copy Files phase which copies Box.framework (and any other framework dependencies you need) into your bundle’s Frameworks directory. If your target is a framework, you may instead want the client app to include Box.framework.