Skip to content

Instantly share code, notes, and snippets.

View Banck's full-sized avatar

Sakhabaev Egor Banck

View GitHub Profile
<activity android:name="com.appodeal.ads.InterstitialActivity"
android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity android:name="com.appodeal.ads.VideoActivity"
android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity android:name="com.appodealx.mraid.MraidActivity"
android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<activity android:name="com.appodeal.ads.LoaderActivity"
struct Place {
var id: String?
var name: String?
var position: String?
init(_ json: JSON) {
id = json["id"].string
name = json["name"].string
position = json["position"].string
}
sources:
- ProjectName/Models
templates:
- ProjectName/Templates
output:
ProjectName/Models
protocol JSONAutoRepresentable {}
{% for type in types.based.JSONAutoRepresentable| %}
// sourcery:inline:auto:{{ type.name }}.JSONAutoRepresentable
init(_ json: JSON) {
...
...
{% elif variable.isArray %}
{{ variable.name }} = json["{{ variable.name|camelToSnakeCase }}"].arrayValue.map({{ variable.typeName.array.elementTypeName.unwrappedTypeName }}.init)
...
...
{% elif variable.type.based.JSONAutoRepresentable %}
{{ variable.name }} = {{ variable.unwrappedTypeName }}(json["{{ variable.name|camelToSnakeCase }}"])
...
...
{% elif variable.type.kind == "enum" %}
{{ variable.name }} = {{ variable.unwrappedTypeName }}(rawValue: json["{{ variable.name|camelToSnakeCase }}"].stringValue) ?? {{ variable.defaultValue }}
...
{% if variable.annotations.jsonKey %}
{{ variable.name }} = json["{{ variable.annotations.jsonKey}}"].{{ variable.unwrappedTypeName|lowerFirstLetter }}{% ifnot variable.isOptional %}Value{% endif %}
{% else %}
{% for variable in type.storedVariables where variable|!annotated:"skip" %}
....