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 | |
import ReactiveCocoa | |
//: # Backoff | |
//: ## Retry with backoff operator | |
extension SignalProducerType { | |
func retryWithBackoff<S: SequenceType where S.Generator.Element == NSTimeInterval>(strategy: S) -> SignalProducer<Value, Error> { | |
var generator = strategy.generate() |
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
struct ExampleView: View { | |
var body: some View { | |
Text("Example") | |
.if(true) { $0.foregroundColor(.red) } | |
} | |
} |
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
// | |
// BlurryVibrantView.swift | |
// | |
// | |
// Created by Adam Bell on 11/9/19. | |
// Copyright © 2019 Adam Bell. All rights reserved. | |
// | |
import SwiftUI | |
import UIKit |
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
func testCombineLatest() { | |
for _ in 1...100 { | |
let e = expectation(description: "Each subject should emit true") | |
let s1 = CurrentValueSubject<Bool, Never>(false) | |
let s2 = CurrentValueSubject<Bool, Never>(false) | |
let cancellable = Publishers.CombineLatest(s1, s2) | |
.sink { | |
if $0, $1 { | |
e.fulfill() | |
} |
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 UIKit | |
import Accelerate | |
enum Dither { | |
case jjn | |
case atkinson | |
} | |
enum Desaturate { | |
case mono |
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 SwiftUI | |
struct ContentView: View { | |
static var toggle = false | |
static let settings: [Setting] = [ | |
.push( | |
label: "Embedded content", | |
[ | |
.text(label: "Deeper!", "Here is some embedded informational text") | |
] |
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 SwiftUI | |
protocol ViewModelContainable: View { | |
associatedtype ViewModel : ObservableObject | |
init(model: ViewModel) | |
} | |
// This struct is a direct MVVM alternative to @StateObject in iOS 14 and Mac OS Big Sur. |
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
// | |
// UIDebouncedColorWell.swift | |
// | |
import UIKit | |
import Combine | |
private class PublishingColor { | |
@Published var color: UIColor? = nil | |
} |
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
// | |
// GeometryReaderStack.swift | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
// of the Software, and to permit persons to whom the Software is furnished to do so, | |
// subject to the following conditions: | |
// |
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
// | |
// AppDelegate.swift | |
// Dock Shooter | |
// | |
// Created by Shihab Mehboob on 01/11/2021. | |
// | |
import Cocoa | |
@main |
OlderNewer