Skip to content

Instantly share code, notes, and snippets.

We couldn’t find that file to show.
DELETE ME - Must create a new gist with an initial file
View GetFromPublisher.swift
import SwiftUI
extension URL {
func getFromPublisher<T: Codable>(property: inout Published<T>.Publisher) {
URLSession.shared.dataTaskPublisher(for: self)
.receive(on: DispatchQueue.main)
.decode(type: T.self, decoder: JSONDecoder())
.assign(to: &property)
sturdysturge / WheelView.swift
Last active July 14, 2020 10:18
WheelView Colour Picker Maker
View WheelView.swift
import SwiftUI
struct RGBAWheelView: WheelPickable {
typealias DataType = RGBAData
let data: DataType
@State var thumbOffset = CGPoint()
var _$thumbOffset: Binding<CGPoint> { $thumbOffset }
let angularGradient: Gradient
let radialGradient: Gradient
init(data: DataType) {
sturdysturge / main.swift
Created May 19, 2019 00:35
Command Line Tool with input and output
View main.swift
import Foundation
print("Whatever you say is repeated")
var inputString = String()
while inputString != "quit"
inputString = readLine()!
print("You said: \(inputString)")
print("The program has ended")