Skip to content

Instantly share code, notes, and snippets.

View aataraxiaa's full-sized avatar
:octocat:
Focusing

Pete Smith aataraxiaa

:octocat:
Focusing
  • DuckDuckGo
  • 10:09 (UTC +01:00)
View GitHub Profile
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
// ...
guard fetchedElements.last! != knownOldestElement else { return }
// Fetch next page
// ...
@aataraxiaa
aataraxiaa / UIButton+Duplicate.swift
Created September 4, 2017 13:10
UIButton extension which enables the caller to duplicate a UIButton
//
// UIButton+Duplicate.swift
//
// Created by Peter Smith on 04/09/2017.
//
import UIKit
/// UIButton extension which enables the caller to duplicate a UIButton
extension UIButton {
# Workflow to build and deploy site to Github Pages using Hugo
# Name of Workflow
name: github pages
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
import SwiftUI
import MapKit
// Main view
struct ContentView: View {
// Provides an annotation immedidately (synchronously)
var synchronousAnnotationMaker = SynchronousAnnotationMaker()
var body: some View {
import SwiftUI
import MapKit
// Main view
struct ContentView: View {
// Provides an annotation after some delay (asynchronously)
@ObservedObject var asynchronousAnnotationMaker = AsynchronousAnnotationMaker()
var body: some View {
import SwiftUI
import MapKit
// Main view
struct ContentView: View {
// Provides an annotation after some delay (asynchronously)
@ObservedObject var asynchronousAnnotationMaker = AsynchronousAnnotationMaker()
var body: some View {
struct ContentView: View {
@State private var appSetupState = "App NOT setup ☹️"
// #1
@AppStorage("needsAppOnboarding") private var needsAppOnboarding: Bool = true
var body: some View {
// #2
extension ContentView {
private var mainView: some View {
VStack {
Spacer()
Button(action: {
needsAppOnboarding = true
}) {
Text("Reset Onboarding")
.padding(.horizontal, 40)
struct OnboardingView: View {
var body: some View {
// #1
VStack {
Spacer(minLength: 150)
Image(systemName: "wand.and.stars")
.resizable()
.aspectRatio(contentMode: .fit)
struct OnboardingButton: View {
// #1
@AppStorage("needsAppOnboarding") var needsAppOnboarding: Bool = true
var body: some View {
GeometryReader { proxy in
LazyHStack {
Button(action: {