Skip to content

Instantly share code, notes, and snippets.

@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);
@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 {
@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)
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/
@cerupcat
cerupcat / Tappable UIView
Last active January 29, 2022 16:09
Turn any UIView into a tappable button that animates and calls a selector
import Foundation
import UIKit
@propertyWrapper
class Tappable<T: UIView>: NSObject, UIGestureRecognizerDelegate {
// MARK: - Public Properties
public var wrappedValue: T? {
willSet {
removeGesture()
@dkun7944
dkun7944 / UIView+3DFloatingEffect.swift
Last active February 9, 2021 20:19
Extension to add a cool 3D floating effect to any UIView.
extension UIView {
func add3DFloatingEffect(withDepth depth: Double = 1 / 12, duration: Double = 5) {
let depthAngle = depth * .pi
let rotationAnimationY = CABasicAnimation(keyPath: "transform.rotation.y")
rotationAnimationY.fromValue = NSNumber(floatLiteral: -1 * depthAngle)
rotationAnimationY.toValue = NSNumber(floatLiteral: depthAngle)
rotationAnimationY.duration = duration
rotationAnimationY.repeatCount = Float(Int.max)
rotationAnimationY.autoreverses = true
rotationAnimationY.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
@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
@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