Skip to content

Instantly share code, notes, and snippets.

protocol Buildable: class {
associatedtype R: Routable
associatedtype I: Interactable
associatedtype P: Presentable
func build(store: AppStore) -> R!
func configure(store: AppStore, router: R, interactor: I, presenter: P?)
}
class Builder<R: Routable, I: Interactable, P: Presentable> {
protocol Interactable: class {//, StoreSubscriber {
associatedtype R: Routable
associatedtype P: Presentable
func configure(store: AppStore, router: R, presenter: P?)
func interactorDidAttach()
func interactorWillDetach()
func newState(state: AppState)
}
protocol Routable: class {
associatedtype I: Interactable
func configure(interactor: I, viewController: UIViewController?)
func attach(router: Router<I>)
func detach(router: Router<I>)
}
class Router<I: Interactable>: Routable {
var interactor: Interactable!
protocol Presentable: class {
var viewController: UIViewController { get }
}
protocol Presenter: Presentable {
}
extension UIViewController: Presenter {
var viewController: UIViewController { return self }
@ethanjdiamond
ethanjdiamond / swift
Created June 29, 2019 17:44
Using Live Preview with Xcode11 and UIKit
#if DEBUG && canImport(SwiftUI)
import SwiftUI
extension SomeViewController: UIViewControllerRepresentable {
typealias UIViewControllerType = SomeViewController
func makeUIViewController(context: UIViewControllerRepresentableContext<UIViewControllerType>) -> UIViewControllerType {
return SomeViewController()
}
POST /
content-type: application/json
accept: application/json
{
"type": "transaction",
"entry": [
{
"request": {
"method": "PUT",
POST /fhir
content-type: application/json
accept: application/json
{"type":"transaction","entry":[{"request":{"method":"PUT","url":"/StructureDefinition?_id=VisitCard"},"resource":{"id":"VisitCard","resourceType":"StructureDefinition","url":"http://localhost:3005/StructureDefinition/VisitCard","version":"1.0.0","name":"VisitCard","status":"active","description":"A card that patients interact with","fhirVersion":"4.0.1","kind":"resource","abstract":false,"type":"VisitCard","baseDefinition":"http://hl7.org/fhir/StructureDefinition/Element","derivation":"specialization","differential":{"element":[{"id":"VisitCard","path":"VisitCard","short":"VisitCard","definition":"A card that patients interact with"},{"id":"VisitCard.status","path":"VisitCard.status","short":"The status of the card - in-progress | finished | cancelled","definition":"The status of the card - in-progress | finished | cancelled","min":0,"max":"1","type":[{"code":"code"}]},{"id":"VisitCard.type","path":"VisitCard.type","short":"The card type","de