Skip to content

Instantly share code, notes, and snippets.

@TimMedcalf
TimMedcalf / tableViewKeyboardHandling.m
Last active May 6, 2024 14:21
The easy & reliable way of handling UITableView insets when the keyboard is shown. This works unchanged no matter where the table view is on the screen (including dealing with orientation, hierarchy, container view controllers & all devices)
/*
One of the first things someone new to iOS Development finds is that dealing with the keyboard is trickier
than they think it should be. Simply changing the scrolling extents of a UITableView (or UIScrollView, or
UICollectionView) that is partially covered by they keyboard reveals a lot about the internals of how iOS
works and highlights various "gotchas" that need to be considered.
There are various ways to know that a keyboard has been shown - but observing some specific notifications
provides a reliable way to allow you to modify your views to deal with it.
@realvjy
realvjy / ChoasLinesShader.metal
Last active April 19, 2024 20:01
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
import SwiftUI
extension CGPoint {
static func *(lhs: Self, rhs: CGFloat) -> Self {
.init(x: lhs.x * rhs, y: lhs.y * rhs)
}
}
// Idea: https://www.framer.com/showcase/project/lo2Qka8jtPXrjzZaPZdB/
@DreamingInBinary
DreamingInBinary / Best in Class iOS Checklist
Last active January 29, 2024 18:18
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support
@dkun7944
dkun7944 / CDView.swift
Last active January 14, 2024 23:45
SwiftUI + Swift.Shader CD
//
// CDView.swift
// CD
//
// Created by Daniel Kuntz on 7/3/23.
//
import SwiftUI
struct ShapeWithHole: Shape {
//
// Blobs.swift
// SwiftUI Demos
//
// Created by Morten Just on 1/31/23.
//
import SwiftUI
struct Blobs: View {
@truizlop
truizlop / CircleWave.swift
Created September 29, 2020 15:43
Circle wave animation
import SwiftUI
struct CircleWave: Shape {
let N = 360
let SPEED: Double = 1 / 1000.0
let SHIFT: Double = 2 * Double.pi / 3
let FREQUENCY: Double = 8
var factor: Double
var colorIndex: Double
@darkseed
darkseed / Reachability.h
Created August 30, 2011 23:16 — forked from dhoerl/Reachability.h
Reachability (iOS) ARCified
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
@samrshi
samrshi / ContentView.swift
Created July 1, 2022 05:38
SwiftUI - Snapshot the view inside a UIViewRepresentable (barely) using Combine
import SwiftUI
import Combine
struct ContentView: View {
@State private var text = "A\nB\nC\nD\nE\nF\nG\nH"
@State private var image: Image?
private let snapshotRequester = PassthroughSubject<Void, Never>()
var body: some View {
import SwiftUI
struct NewStopView: View {
let stop: Model.Stop
var body: some View {
Text("New Layout").font(.title)
RouteLayout(spacing: 8) {
ForEach(stop.routes ?? []) { route in
RouteView(route: route)