- Identity being tied to the instance you join is very limiting. While a lot of instances have public feeds you could at least browse without logging in, in theory, many don't and require you to have an account. So if you wanted to get that "small town" feel in one small instance, you have to actually make an account and join it to do so. That's cumbersome and feels very unnecessary. I think identity could be sharable between instances in some fashion. Imagine you could join instance X and then click a join button on instance Y that takes your X identity and links it over to Y in much the same way that remote follows work. Perhaps as part of this process you could even optionally take on a new local name on the Y instance if you wanted and appear as if you are a truly local user, but under the hood there'd be a linkage between the two identities creating a kind of web of trust (if that's the right term). Thus you could someday later join instance Z using either your X or Y identity but doing so would link all
View TestLayout.swift
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 TestLayout: Layout { | |
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { | |
// Assuming this layout is in a fixed size container and isn't sizing itself based on the subviews. | |
return proposal.replacingUnspecifiedDimensions() | |
} | |
func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) { | |
let availableWidth = bounds.size.width | |
let offeredWidth = availableWidth / CGFloat(subviews.count) | |
let subviewProposal = ProposedViewSize(width: offeredWidth, height: bounds.size.height) |
View rosactrl.swift
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
// The original Container protocol. | |
protocol Container { | |
associatedtype Item | |
func deleteItem(_: Item) | |
} | |
// Let's make a couple of concrete containers that use our protocol: | |
class StringContainer: Container { | |
typealias Item = String |
View PagingView.swift
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
// | |
// PagingView.swift | |
// Wallaroo - https://wallaroo.app | |
// | |
// Created by Sean Heber (@BigZaphod) on 8/9/22. | |
// | |
import SwiftUI | |
// This exists because SwiftUI's paging setup is kind of broken and/or wrong out of the box right now. |
View ExponentialBackoff.swift
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
// | |
// Created by Sean Heber on 8/11/22. | |
// | |
import Foundation | |
enum ExponentialBackoffError : Error { | |
case retryLimitExceeded | |
} |
View DragGesture+Velocity.swift
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
// It is absolutely insane that velocity isn't public. | |
// INSANE. | |
// I don't get it. | |
// So anyway, this works but is kind of horrible. | |
// It's probably pretty safe to use and it should fallback to 0 if something goes wrong. | |
// Maybe. | |
extension DragGesture.Value { | |
var secretVelocity: CGSize { | |
let mirror = Mirror(reflecting: self) | |
guard let velocity = mirror.children.first(where: { $0.label == "velocity" }) else { |
View View+Assign.swift
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
// | |
// View+Assign.swift | |
// Created by Sean on 7/29/22. | |
// | |
import SwiftUI | |
// You cannot safely assign to a state variable during view update - such as inside the block of a GeometryReader. | |
// Rather than do an unsafe hack like DispatchQueue.main.async or resorting to a PreferenceKey or even Combine, we | |
// can simply defer the assignment to a time when it *is* safe to update State- such as inside of the task block! |
View KeychainStorage.swift
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
// | |
// A simplified implementation of https://gist.github.com/sturdysturge/e5163a9e95826adbeff9824d5aa1d111 | |
// Which has an associated article here: https://betterprogramming.pub/build-a-secure-swiftui-property-wrapper-for-the-keychain-e0f8e39d554b | |
// Requires the Keychain Access package: https://github.com/kishikawakatsumi/KeychainAccess | |
// | |
import SwiftUI | |
import KeychainAccess | |
@propertyWrapper |
View Indirect.swift
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
// | |
// A Swift property wrapper for adding "indirect" to struct properties. | |
// Enum supports this out of the box, but for some reason struct doesn't. | |
// | |
// This is useful when you want to do something recursive with structs like: | |
// | |
// struct Node { | |
// var next: Node? | |
// } | |
// |
View UnstructuredMastodonThoughts.md
NewerOlder