Skip to content

Instantly share code, notes, and snippets.

View garrettmurray's full-sized avatar
📱
Buildin' stuff

Garrett Murray garrettmurray

📱
Buildin' stuff
View GitHub Profile
@garrettmurray
garrettmurray / Example.swift
Last active February 1, 2024 01:44
An example solution for .onDelete issues with nested sections of data in SwiftUI. Thanks to @mayoff for help!
import SwiftUI
func bind<Value, Answer>(_ value: Value, to answer: (Value) -> Answer) -> Answer { answer(value) }
struct Example: View {
struct SomeGroup: Identifiable, RandomAccessCollection {
typealias Indices = CountableRange<Int>
public typealias Index = Int;
var id: Int
@garrettmurray
garrettmurray / gist:5342519
Created April 9, 2013 02:45
Use a UIRefreshControl with a UIViewController that contains a tableView property.
// Set up the UIRefreshControl.
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self
action:@selector(refreshInvoked:forState:)
forControlEvents:UIControlEventValueChanged];
// Create a UITableViewController so we can use a UIRefreshControl.
UITableViewController *tvc = [[UITableViewController alloc] initWithStyle:self.tableView.style];
tvc.tableView = self.tableView;
tvc.refreshControl = self.refreshControl;
@garrettmurray
garrettmurray / gist:5157653
Created March 13, 2013 23:59
Solve lots of iOS problems
exit();