Skip to content

Instantly share code, notes, and snippets.

View apparition47's full-sized avatar
📱
(╯°□°)╯︵ ┻━┻

Aaron Lee apparition47

📱
(╯°□°)╯︵ ┻━┻
View GitHub Profile
extension Result {
public func `catch`(_ handler: () throws -> Success) -> Result<Success, Error> {
flatMapError { _ in
.init { try handler() }
}
}
public func `catch`(_ handler: (Failure) throws -> Success) -> Result<Success, Error> {
flatMapError { error in
.init { try handler(error) }
import lldb
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f SwiftPrinter.printer pjson')
def printer(debugger, command, result, internal_dict):
debugger.HandleCommand('p print(String(data: try! JSONSerialization.data(withJSONObject:' + command + ', options: .prettyPrinted), encoding: .utf8 )!)')
@globulus
globulus / Weighted.swift
Created December 11, 2021 13:05
Weighted HStack and VStack in SwiftUI
// Full recipe at https://swiftuirecipes.com/blog/weighted-layout-hstack-and-vstack-in-swiftui
import SwiftUI
class WeightedProxy {
let kind: Kind
var geo: GeometryProxy? = nil
private(set) var totalWeight: CGFloat = 0
init(kind: Kind) {