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
// | |
// BlurReplalce.swift | |
// SwiftUI Scratchpad | |
// | |
// Created by Johan Sørensen on 07/05/2024. | |
// | |
import SwiftUI | |
@available(iOS 17.0, *) |
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 | |
final actor Worker: ObservableObject { | |
@MainActor @Published private(set) var lastWorkDoneAt: Date? | |
private var counter = 0 | |
func doWork() { | |
self.counter += 1 | |
DispatchQueue.main.async { | |
self.lastWorkDoneAt = .now | |
} |
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 UnderConstructionModifier: ViewModifier { | |
func body(content: Content) -> some View { | |
content | |
.redacted(reason: .placeholder) | |
.blur(radius: 8) | |
.overlay(Color.pink.opacity(0.33)) | |
.overlay( | |
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 | |
@available(iOS, deprecated: 16.0, message: "Use SwiftUI.scrollContentBackground()") | |
struct HidesScrollContentBackground: ViewModifier { | |
init() { | |
if #unavailable(iOS 16.0) { | |
// beware, affects the app-global appearance proxy: | |
// UITableView.appearance().backgroundColor = .clear | |
} | |
} |
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 | |
let json1 = """ | |
{"results": [{"name": "bob"}]} | |
""".data(using: .utf8)! | |
let json2 = """ | |
{"people": [{"name": "Jane"}]} | |
""".data(using: .utf8)! |
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 | |
enum Item: Codable { | |
case int(Int) | |
case string(String) | |
private enum CodingKeys: String, CodingKey { | |
case kind | |
case 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
.... | |
[alias] | |
sel = select | |
asel = add-select | |
rsel = reset-select | |
... |
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
#!/bin/sh | |
git log --no-walk --date-order --oneline --decorate $(git rev-list --branches --no-walk) |
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
:10000000FFFFFFFFFFFFFFFF012300230060FFFF53 | |
:1000100041F7F1A100000000000000000000000016 | |
:1000200000000000000000000000000000000000D0 | |
:1000300000000000000000000000000000000000C0 | |
:1000400000000000000000000000000000000000B0 | |
:100050000000291E1F20212223242526272D2E2A99 | |
:100060004C0000002B141A0815171C180C12132F23 | |
:1000700030314A00000039041607090A0B0D0E0F33 | |
:10008000333400284E000000E1641D1B06190511E1 | |
:1000900010363738E5524B000000C0E2E3000000A4 |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
struct Person { | |
var name = Observable("Bob") | |
} | |
enum Event<T> { | |
case next(T) |
NewerOlder