Skip to content

Instantly share code, notes, and snippets.

View PaulWoodIII's full-sized avatar

Paul Wood III PaulWoodIII

View GitHub Profile
@PaulWoodIII
PaulWoodIII / ArrayOfArrayView.swift
Last active August 23, 2019 22:12
playing around with published sequence types, you need wrapper objects
//
// ArrayOfArrayView.swift
// PublishedList
//
// Created by Paul Wood on 8/23/19.
// Copyright © 2019 Paul Wood. All rights reserved.
//
import SwiftUI
import Combine
import SwiftUI
struct TriangleView: View {
var body: some View {
GeometryReader { proxy in
return ZStack {
Path { path in
@PaulWoodIII
PaulWoodIII / GraphView.swift
Created August 25, 2019 23:55
In SwiftUI use a Geometry Reader to read the position of a child view and draw other views according to the Childs frame
//
// GraphView.swift
// ParentChildLines
//
// Created by Paul Wood on 8/25/19.
// Copyright © 2019 Paul Wood. All rights reserved.
//
import SwiftUI
@PaulWoodIII
PaulWoodIII / UIView+VisualRecursiveDescription.h
Last active February 6, 2022 15:01
Provide Swift with the amazing ability to visually print a UICollectionView's VisualRecursiveDescription
//
// UIView+VisualRecursiveDescription.h
//
// Created by Paul Wood on 8/28/19.
// Copyright © 2019 Paul Wood. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@PaulWoodIII
PaulWoodIII / ReverseWordsInAString.swift
Created August 31, 2019 00:14
classic interview question done two ways in Swift
//
// main.swift
// ReverseWordsInAString
//
// Created by Paul Wood on 8/30/19.
// Copyright © 2019 Paul Wood. All rights reserved.
//
import Foundation
@PaulWoodIII
PaulWoodIII / Pulse.swift
Created August 31, 2019 22:56
helpful object that will emit regularly
//
// Pulse.swift
//
// Created by Paul Wood on 8/31/19.
// Copyright © 2019 Paul Wood. All rights reserved.
//
import Foundation
import Combine
@PaulWoodIII
PaulWoodIII / Sounds.swift
Created September 2, 2019 15:00
Some gameplay sounds written in swift using Combine, I'm acting like this is a legacy component even though it isn't so it uses NSNotificationCenter
//
// Sounds.swift
//
// Created by Paul Wood on 9/2/19.
// Copyright © 2019 Paul Wood. All rights reserved.
//
import Foundation
import Combine
import AVFoundation
@PaulWoodIII
PaulWoodIII / Explosion.swift
Created September 2, 2019 17:29
Little SwiftUI animation to fill the screen with red circle from the center of the screen
//
// ContentView.swift
// ExplosionView
//
// Created by Paul Wood on 9/2/19.
// Copyright © 2019 Paul Wood. All rights reserved.
//
import SwiftUI
@PaulWoodIII
PaulWoodIII / summedPair
Created September 9, 2019 18:34
twoSum Leetcode question 1 with Swift Generics
import Foundation
/*
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
@PaulWoodIII
PaulWoodIII / GCD.swift
Last active September 12, 2019 01:07
Three approaches to the same problem. I think the second is best for swift but I made the third for fun to display the algorithm as a stream, missing the first higher though...
func gcd_recursive(_ a: Int, _ b : Int) -> Int {
let higher = max(a, b)
let lower = min(a, b)
let r = higher % lower
if r == 0 {
return lower
}
return gcd_recursive(lower, r)
}