This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
{% macro swiftifyMethodName name %}{{ name | replace:"(","_" | replace:")","" | replace:":","_" | replace:"`","" | snakeToCamelCase | lowerFirstWord }}{% endmacro %} | |
{% for protocol in types.protocols where protocol.based.AutoDelegateWrapper or protocol|annotated:"AutoDelegateWrapper" %} | |
{% if type.name != "AutoDelegateWrapper" %} | |
class {{ protocol.name }}Wrapper: {{ protocol.name }} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for type in types.all where type.based.AutoCodableObjc or type|annotated:"AutoCodableObjc" %} | |
// sourcery:inline:auto:{{ type.name }}.AutoCodableObjc | |
enum CodingKeys: String, CodingKey { | |
{% for variable in type.allVariables where variable.isComputed == false %}case {{variable.name}} | |
{% endfor %} | |
} | |
{{type.accessLevel}} required init(from decoder: Decoder) throws { | |
let container = try decoder.container(keyedBy: CodingKeys.self) | |
{% for variable in type.allVariables where variable.isComputed == false %}{{variable.name}} = try{% if variable.isOptional %}?{% endif %} container.decode({{variable.typeName}}.self, forKey: .{{variable.name}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@propertyWrapper | |
open class PropertyWrapperWithOpenInit { | |
var _value: String | |
open init(wrappedValue: String) { // error: only classes and overridable class members can be declared 'open'; use 'public' | |
self._value = wrappedValue | |
} | |
open var wrappedValue: String { | |
get { | |
return _value | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
description: "description" | |
version: 1.0.0 | |
title: OpenAPI | |
tags: | |
- name: person | |
description: persons | |
paths: | |
/person: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
description: "description" | |
version: 1.0.0 | |
title: OpenAPI | |
tags: | |
- name: person | |
description: persons | |
paths: | |
/person: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
components: | |
schemas: | |
EventMotive: | |
additionalProperties: false | |
properties: | |
eventType: | |
$ref: '#/components/schemas/MotivesCategory' | |
id: | |
format: int32 | |
type: integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
otool -l path/to/libxpto.a | grep bitcode | wc -l | |
OUTPUT: | |
0 - No bitcode support | |
>1 - Bitcode support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class SampleViewController: StoryboardBackedViewController { | |
// Unfortunately this must be an IUO var, so that we can set the value after super.init | |
private var member: Foo! | |
// Proper dependency injection in a storyboard backed VC! | |
init(foo: Foo) { | |
super.init(storyboardIdentifier: "SampleViewControllerIdentifier") | |
// We have to set the members *after* calling super.init, since it changes the instance of `self`. | |
self.member = foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://speakerdeck.com/realm/natasha-murashev-practical-protocol-oriented-programming?slide=19 | |
import UIKit | |
protocol Shakeable { | |
} | |
extension Shakeable where Self: UIView { | |
func shake() { | |
print("shake") | |
} |