Skip to content

Instantly share code, notes, and snippets.

View kieranb662's full-sized avatar
🏠
Working from home

Kieran Brown kieranb662

🏠
Working from home
View GitHub Profile
@kieranb662
kieranb662 / FixedTabBar.swift
Created July 24, 2021 21:35
A Fixed Tab Bar component made in SwiftUI. Created as an example of a component that supports styles and library content. Check the bottom In the preview to see How to use.
// Swift toolchain version 5.0
// Running macOS version 12.0
// Created on 7/24/21.
//
// Author: Kieran Brown
//
import SwiftUI
// MARK: -Component-
@kieranb662
kieranb662 / CollapsibleGridLines.swift
Created July 24, 2021 00:46
Animated Grid that can collapse from any number of rows and columns to a 2x2 square. Made With SwiftUI.
// Swift toolchain version 5.0
// Running macOS version 12.0
// Created on 6/24/21.
//
// Author: Kieran Brown
//
import SwiftUI
struct CollapsibleGridLines: View {
@kieranb662
kieranb662 / RainingCloudAnimation.swift
Created July 23, 2021 23:38
A raining cloud animation made with SwiftUI as a demo to try out the new Canvas and Timeline Views.
// Swift toolchain version 5.0
// Running macOS version 12.0
// Created on 6/24/21.
//
// Author: Kieran Brown
//
import SwiftUI
fileprivate func makeDroplets(count: Int = 10, xRange: Range<Int> = 20..<350, yRange: Range<Int>) -> [CGPoint] {
@kieranb662
kieranb662 / StickyDrag.swift
Created November 2, 2020 03:22
Sticky drag modifier. This modifier adds a drag gesture to the view it modifies. This drag gesture behaves a lot like a rubber band be pulled to its breaking point.
// Swift toolchain version 5.0
// Running macOS version 10.15
// Created on 11/1/20.
//
// Author: Kieran Brown
//
import SwiftUI
import UIKit
@kieranb662
kieranb662 / Eye.md
Last active October 31, 2020 23:46
A toggle switch that looks like an Eye opening and closing. Happy Halloween!

output

@kieranb662
kieranb662 / MathCharacters.swift
Last active October 16, 2020 17:32
[Swift Math Characters] File containing selected math characters for easy use while rendering equations #Math #Text
struct Greek {
static var alpha = "α"
static var beta = "β"
static var gamma = "γ"
static var delta = "δ"
static var epsilon = "ε"
static var zeta = "ζ"
static var eta = "η"
static var theta = "θ"
static var iota = "ι"
@kieranb662
kieranb662 / SVGPathParser.swift
Created June 4, 2020 22:05
SVG -> iOS Bezier Curves
import Foundation
import CoreGraphics
/// #SVGPath
/// A class that can take any svg path string and convert it to the
/// equivalent CGMutablePath
@kieranb662
kieranb662 / Sheen.md
Last active June 29, 2020 18:27
[Sheen ViewModifier] SwiftUI Sheen Modifier #SwiftUI #ViewModifier

Sheen Effect

@kieranb662
kieranb662 / Pulse.md
Last active January 31, 2024 17:20
[Pulse ViewModifier] Pulse SwiftUI ViewModifier #SwiftUI #ViewModifier

Circle Pulse

@kieranb662
kieranb662 / RationalNumber.swift
Last active October 16, 2020 17:34
[Rational Number Type] Rational number implementation in swift #Math
import Foundation
struct RationalNumber {
let numerator: Int
let denominator: Int
// todo: fix this so that infinities are handled properly
var decimal: Double {
denominator != 0 ? Double(numerator)/Double(denominator) : .infinity
}