Skip to content

Instantly share code, notes, and snippets.

View SzymonMrozek's full-sized avatar

Szymon Mrozek SzymonMrozek

View GitHub Profile
import Combine
{% if argument.imports %}{{ argument.imports }}{% endif %}
{% for type in types.all where type|annotated:"AutoCombineTestUtil" %}
extension {{ type.name }} {
struct TestUtil {
{% for property in type.storedVariables where property.readAccess != "private" %}
let {{ property.name }}: {% if property.type|annotated:"AutoCombineTestUtil" %}{% if property.isOptional %}{{ property.typeName | replace:"?","" }}.TestUtil?{% else %}{{ property.typeName }}.TestUtil {% endif %} {% elif property.typeName|contains:"AnySubscriber" %}{{ property.typeName|replace:"AnySubscriber","PassthroughSubject"}}{% elif property.typeName|contains:"AnyPublisher" %}CurrentValueSubject<{{ property.typeName.generic.typeParameters.first.typeName }}?, Never>{% else %}{{ property.typeName }}{% endif %}
{% endfor %}
@SzymonMrozek
SzymonMrozek / ConstraintsOperators.swift
Last active November 28, 2019 18:50
Set of useful operators for more readable creation of constraints
import UIKit
import Foundation
infix operator ~ : RangeFormationPrecedence
public enum AnchorOption: Hashable {
case priority(UILayoutPriority)
case multiplier(CGFloat)
case constant(CGFloat)