Zewo / Reflection
Licence: mit
DEPRECATED
Stars: ✭ 592
Programming Languages
Projects that are alternatives of or similar to Reflection
Venice
Coroutines, structured concurrency and CSP for Swift on macOS and Linux.
Stars: ✭ 1,501 (+153.55%)
Mutual labels: server-side-swift, server, swiftpm
Kitura
A Swift web framework and HTTP server.
Stars: ✭ 7,533 (+1172.47%)
Mutual labels: server-side-swift, server
Swiftserverside Vapor
🦄 Swift server open source projects based on the Swift 4.1 and Vapor 3 frameworks. (Swift 服务端开源项目)
Stars: ✭ 588 (-0.68%)
Mutual labels: server-side-swift, server
Django Access
Django-Access - the application introducing dynamic evaluation-based instance-level (row-level) access rights control for Django
Stars: ✭ 47 (-92.06%)
Mutual labels: runtime, dynamic
JqueryDataTablesServerSideDemo
Jquery DataTables with Asp.Net Core server side multi column sorting and searching Demo Project.
Stars: ✭ 43 (-92.74%)
Mutual labels: runtime, dynamic
Hummingbird
Lightweight, flexible HTTP server framework written in Swift
Stars: ✭ 114 (-80.74%)
Mutual labels: server-side-swift, server
Hypertext
Any-way-you-want-it, type-safe HTML in Swift.
Stars: ✭ 236 (-60.14%)
Mutual labels: server-side-swift, server
Zewo
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.
Stars: ✭ 1,856 (+213.51%)
Mutual labels: server-side-swift, swiftpm
Flock
Automated deployment of Swift projects to servers
Stars: ✭ 127 (-78.55%)
Mutual labels: server-side-swift, server
Walkable
A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
Stars: ✭ 384 (-35.14%)
Mutual labels: server, dynamic
Dynamic Struct
Golang package for editing struct's fields during runtime and mapping structs to other structs.
Stars: ✭ 257 (-56.59%)
Mutual labels: runtime, dynamic
Vapor
💧 A server-side Swift HTTP web framework.
Stars: ✭ 21,194 (+3480.07%)
Mutual labels: server-side-swift, server
Perfectdocs
Reference and documentation for Perfect (Server-side Swift). Perfect (支持服务器端Swift语言的软件函数库)使用文档和参考手册.
Stars: ✭ 564 (-4.73%)
Mutual labels: server-side-swift
Ejabberd
Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
Stars: ✭ 5,077 (+757.6%)
Mutual labels: server
Wasmtime
Standalone JIT-style runtime for WebAssembly, using Cranelift
Stars: ✭ 6,413 (+983.28%)
Mutual labels: runtime
Swiftybeaver
Convenient & secure logging during development & release in Swift 3, 4 & 5
Stars: ✭ 5,392 (+810.81%)
Mutual labels: server-side-swift
Dart native
Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.
Stars: ✭ 564 (-4.73%)
Mutual labels: runtime
Reflection [DEPRECATED]
Reflection provides an API for advanced reflection at runtime including dynamic construction of types.
Usage
import Reflection
struct Person {
var firstName: String
var lastName: String
var age: Int
}
// Reflects the instance properties of type `Person`
let props = try properties(Person.self)
var person = Person(firstName: "John", lastName: "Smith", age: 35)
// Retrieves the value of `person.firstName`
let firstName: String = try get("firstName", from: person)
// Sets the value of `person.age`
try set(36, key: "age", for: &person)
// Creates a `Person` from a dictionary
let friend: Person = try construct(dictionary: ["firstName" : "Sarah",
"lastName" : "Gates",
"age" : 28])
Installation
import PackageDescription
let package = Package(
dependencies: [
.Package(url: "https://github.com/Zewo/Reflection.git", majorVersion: 0, minor: 15),
]
)
Advanced Usage
// `Reflection` can be extended for higher-level packages to do mapping and serializing.
// Here is a simple `Mappable` protocol that allows deserializing of arbitrary nested structures.
import Reflection
typealias MappableDictionary = [String : Any]
enum Error : ErrorProtocol {
case missingRequiredValue(key: String)
}
protocol Mappable {
init(dictionary: MappableDictionary) throws
}
extension Mappable {
init(dictionary: MappableDictionary) throws {
self = try construct { property in
if let value = dictionary[property.key] {
if let type = property.type as? Mappable.Type, let value = value as? MappableDictionary {
return try type.init(dictionary: value)
} else {
return value
}
} else {
throw Error.missingRequiredValue(key: property.key)
}
}
}
}
struct Person : Mappable {
var firstName: String
var lastName: String
var age: Int
var phoneNumber: PhoneNumber
}
struct PhoneNumber : Mappable {
var number: String
var type: String
}
let dictionary = [
"firstName" : "Jane",
"lastName" : "Miller",
"age" : 54,
"phoneNumber" : [
"number" : "924-555-0294",
"type" : "work"
] as MappableDictionary
] as MappableDictionary
let person = try Person(dictionary: dictionary)
Support
If you need any help you can join our Slack and go to the #help channel. Or you can create a Github issue in our main repository. When stating your issue be sure to add enough details, specify what module is causing the problem and reproduction steps.
Community
The entire Zewo code base is licensed under MIT. By contributing to Zewo you are contributing to an open and engaged community of brilliant Swift programmers. Join us on Slack to get to know us!
License
This project is released under the MIT license. See LICENSE for details.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].