Allegro 1.2.1

Allegro 1.2.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jun 2016
SPMSupports SPM

Maintained by Brad Hilton.



Allegro 1.2.1

  • By
  • Brad Hilton

Allegro

Allegro is an advanced Swift reflection utility that allows you to create classes and structs at run-time:

struct Person {
   var name: String
   var age: Int
   var friends: [Person]
}
// Returns fields for Person
let fields = try fieldsForType(Person)
// Constructs Person
let person: Person = try constructType { field in
  // return value for field
}

Be aware that every property of the type you’d like to construct must conform to Property.

Installation

Swift Package Manager

You can also build Allegro using the Swift Package Manager. Just include Allegro as a package in your dependencies:

.Package(url: "https://github.com/bradhilton/Allegro.git", majorVersion: 1)

Be sure to import the module at the top of your .swift files:

import Allegro

Revision History

  • 1.0.0 - Initial Release

Author

Brad Hilton, [email protected]

License

Allegro is available under the MIT license. See the LICENSE file for more info.