Skip to content

Instantly share code, notes, and snippets.

class AnimatingFramedView: UIView {
var isPaused = false
private var timer: Timer?
private lazy var viewFrameUpdater = RealTimeViewUpdator(delegate: self)
var tick = 0
enum EdgeAction {
case add(EdgeList.EdgeSpec)
case select(EdgeList.EdgeSpec)
case deleteSelected(EdgeList.EdgeSpec.Node, NodeType)
}
enum NodeType {
case workspace
case project
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
import SwiftUI
final class Store<Value, Action>: ObservableObject {
let reducer: (inout Value, Action) -> Void
@Published private(set) var value: Value
init(initialValue: Value, reducer: @escaping (inout Value, Action) -> Void) {
self.reducer = reducer
self.value = initialValue
import SwiftUI
final class Store<Value, Action>: ObservableObject {
let reducer: (inout Value, Action) -> Void
@Published private(set) var value: Value
init(initialValue: Value, reducer: @escaping (inout Value, Action) -> Void) {
self.reducer = reducer
self.value = initialValue
struct Test: View {
let binding: Binding<String>
let store: Store<AppState, AppAction>
init(store: Store<AppState, AppAction>) {
self.store = store
self.binding = .init(
get: { store.value.testVal },
set: { store.send(.setTestVal($0)) }
init<ItemType: ListItemDisplayable>(
menuItems: Observable<[ContextMenuItem]> = .just([]),
getTitle: @escaping () -> Single<String> = { .just("") },
getItems: @escaping ItemsFetcher<ItemType>,
externalReload: Observable<Void> = env.reload.asObservable(),
filteringEnabled: Bool = false,
emptyListMessage: String = "There are no items to show",
filterFunc: @escaping ListItemFilterFunction<ItemType> = { (items, _) in items }
) {
class SettingsControllerFacade {
private let bag = DisposeBag()
private let controller: SettingsControllerType
private let _settingGroups = PublishSubject<[SettingGroup]>()
init(
controller: SettingsControllerType
) {
class ViewController: UIViewController {
class TestVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .green
}
}
class MenuView: NodeSubscriber<String> {
override func getSlice(_ state: AppState) -> SliceResult<String> {
return .stateSlice("")
}
override func makeNode(from slice: String) -> Node {
func setRoute(route: WorkspaceRoute) {
store.dispatch(SetRouteAction([route.rawValue]))