Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Yq | 9,381 | 70 | 3 days ago | 126 | July 12, 2023 | 100 | mit | Go | ||
yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor | ||||||||||
Fast Json Stringify | 3,252 | 747 | 167 | 5 days ago | 145 | August 02, 2023 | 21 | mit | JavaScript | |
2x faster than JSON.stringify() | ||||||||||
Jsonmapper | 1,508 | 702 | 219 | a month ago | 38 | April 09, 2023 | 4 | osl-3.0 | PHP | |
Map nested JSON structures onto PHP classes | ||||||||||
Dynamic_widget | 1,353 | 3 | 1 | 9 months ago | 29 | May 19, 2022 | 43 | apache-2.0 | Dart | |
A Backend-Driven UI toolkit, build your dynamic UI with json, and the json format is very similar with flutter widget code. | ||||||||||
Jackson Annotations | 982 | 29,185 | 4,843 | 12 days ago | 129 | May 26, 2022 | 12 | apache-2.0 | Java | |
Core annotations (annotations that only depend on jackson-core) for Jackson data processor | ||||||||||
Sleekdb | 779 | 4 | 7 | 5 months ago | 35 | October 10, 2021 | 29 | mit | PHP | |
Pure PHP NoSQL database with no dependency. Flat file, JSON based document database. | ||||||||||
Dynamicjson | 703 | a year ago | 6 | January 16, 2019 | 3 | mit | Swift | |||
Access JSON properties dynamically like JavaScript using Swift 4.2's new @dynamicMemberLookup feature | ||||||||||
Realm Json | 679 | 14 | 6 years ago | 22 | January 13, 2016 | 31 | mit | Objective-C | ||
A concise Mantle-like way of working with Realm and JSON. | ||||||||||
Jsoncodable | 606 | 19 | 3 years ago | 6 | November 08, 2016 | 24 | mit | Swift | ||
Hassle-free JSON encoding and decoding in Swift | ||||||||||
Postcss Custom Properties | 601 | 3 | 2 years ago | 2 | June 18, 2020 | 43 | mit | JavaScript | ||
Use Custom Properties in CSS |
SwinjectPropertyLoader is an extension of Swinject to load property values from resources that are bundled with your application or framework.
Swinject is available through Carthage or CocoaPods.
To install Swinject with Carthage, add the following line to your Cartfile
.
github "Swinject/Swinject" ~> 2.0.0
github "Swinject/SwinjectPropertyLoader" ~> 1.0.0
Then run carthage update --no-use-binaries
command or just carthage update
. For details of the installation and usage of Carthage, visit its project page.
To install Swinject with CocoaPods, add the following lines to your Podfile
.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0' # or platform :osx, '10.10' if your target is OS X.
use_frameworks!
pod 'Swinject', '~> 2.0.0'
pod 'SwinjectPropertyLoader', '~> 1.0.0'
Then run pod install
command. For details of the installation and usage of CocoaPods, visit its official website.
Properties are values that can be loaded from resources that are bundled with your application/framework. Properties can then be used when assembling definitions in your container.
There are 2 types of support property formats:
JsonPropertyLoader
)PlistPropertyLoader
)Each format supports the types specified by the format itself. If JSON format is used
then your basic types: Bool
, Int
, Double
, String
, Array
and Dictionary
are
supported. For Plist, all types supported by the Plist are supported which include all
JSON types plus NSDate
and NSData
.
JSON property files also support comments which allow you to provide more context to your properties besides your property key names. For example:
{
// Comment type 1
"foo": "bar",
/* Comment type 2 */
"baz": 100,
/**
Comment type 3
*/
"boo": 30.50
}
Loading properties into the container is as simple as:
let container = Container()
// will load "properties.json" from the main app bundle
let loader = JsonPropertyLoader(bundle: .mainBundle(), name: "properties")
try! container.applyPropertyLoader(loader)
Now you can inject properties into definitions registered into the container.
Consider the following definition:
class Person {
var name: String!
var count: Int?
var team: String = ""
}
And let's say our properties.json
file contains:
{
"name": "Mike",
"count": 100,
"team": "Giants"
}
Then we can register this Service type with properties like so:
container.register(Person.self) { r in
let person = Person()
person.name = r.property("name")
person.count = r.property("count")
person.team = r.property("team")!
}
This will resolve the person as:
let person = container.resolve(Person.self)!
person.name // "Mike"
person.count // 100
person.team // "Giants"
Properties are available on a per-container basis. Multiple property loaders can be applied to a single container. Properties are merged in the order in which they are applied to a container. For example, let's say you have 2 property files:
{
"message": "hello from A",
"count": 10
}
And:
{
"message": "hello from B",
"timeout": 4
}
If we apply property file A, then property file B to the container, the resulting property key-value pairs would be:
message = "hello from B"
count = 10
timeout = 4
As you can see the message
property was overridden. This only works for first-level
properties which means Dictionary
and Array
are not merged. For example:
{
"items": [
"hello from A"
]
}
And:
{
"items": [
"hello from B"
]
}
The resulting value for items
would be: [ "hello from B" ]
SwinjectPropertyLoader has been originally written by Mike Owens.
MIT license. See the LICENSE file for details.