Skip to content

Instantly share code, notes, and snippets.

We couldn’t find that file to show.
View FBMessages.py
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)
.map(\.data)
.decode(type: T.self, decoder: JSONDecoder())
.assertNoFailure()
.assign(to: &property)
@sturdysturge
sturdysturge / WheelView.swift
Last active Jul 14, 2020
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
sturdysturge / main.swift
Created May 19, 2019
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")