Skip to content

Instantly share code, notes, and snippets.

View StewartLynch's full-sized avatar

Stewart Lynch StewartLynch

View GitHub Profile
@StewartLynch
StewartLynch / 0_reuse_code.js
Created May 28, 2017 21:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@IBAction func showHelp(_ sender: Any) {
let ctHelp = CTHelp()
ctHelp.new(CTHelpItem(title:"No Text-Image Only",
helpText: "",
imageName:"SampleFullSizeImage"))
ctHelp.new(CTHelpItem(title:"Text and Image",
helpText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
imageName:"SampleSmallerImage"))
ctHelp.new(CTHelpItem(title:"No Image-Text Only",
helpText: "Eu tempor suscipit dis sed. Tortor velit orci bibendum mattis non metus ornare consequat. Condimentum habitasse dictumst eros nibh rhoncus non pulvinar fermentum. Maecenas convallis gravida facilisis. Interdum, conubia lacinia magnis duis nec quisque.Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
@IBAction func ShowHelp(_ sender: Any) {
let ctHelp = CTHelp()
// Optional values to set colors
// ctHelp.ctBgViewColor = .white
// ctHelp.ctTitleColor = .darkText
// ctHelp.ctHelpTextColor = .darkGray
// ctHelp.ctActionButtonBGColor = UIColor(red: 28/255, green: 136/255, blue: 197.255, alpha: 1)
// ctHelp.ctActionButtonTextColor = .white
ctHelp.new(CTHelpItem(title:"No Text-Image Only",
struct NewsFeed: Decodable {
let kind: String
let data: OuterData
struct OuterData: Decodable {
let children: [Child]
}
struct Child: Decodable {
let data: InnerData
@StewartLynch
StewartLynch / For Declan
Last active October 21, 2023 13:13
A JSON Parsing example for the dictionary api
import UIKit
struct Post: Decodable {
let word: String
let meanings:[Meanings]
struct Meanings: Decodable {
let partOfSpeech: String?
let definitions: [Definitions]
@StewartLynch
StewartLynch / Crashing Tab
Created October 9, 2020 05:53
App crashes when I try to delete tab
struct Item: Identifiable {
let id = UUID()
var index: Int
static var mockData:[Item] {
return (0...2).map{Item(index: $0)}
}
}
struct ContentView: View {
@State var items = Item.mockData
@StewartLynch
StewartLynch / gist:fefeba0185f6a6cba9bae2d7bae15966
Created January 15, 2021 04:56
Two Objects MagnificationGesture
struct ContentView: View {
@State private var currentMagnification: (CGFloat,CGFloat) = (1,1)
@GestureState private var pinchMagnification: (CGFloat,CGFloat) = (1,1)
var body: some View {
VStack {
Circle()
.fill(Color.green)
.shadow(radius: 20)
.frame(width: 100)
.scaleEffect(currentMagnification.0 * pinchMagnification.0)
@StewartLynch
StewartLynch / Forecast Model
Created February 2, 2021 06:08
Raw Model for Weather App Forecast as generated by CuteBaby
struct Forecast: Codable {
let lat: Double
let lon: Double
let timezone: String
let timezoneOffset: Int
struct Daily: Codable {
let dt: Date
let sunrise: Date
let sunset: Date
struct Temp: Codable {
//
// DebugPrint.swift
// Deep Links Test
//
// Created by Stewart Lynch on 2021-02-09.
//
import Foundation
enum DebugPrint {
import Foundation
struct SalesForce: Codable {
struct Records: Codable {
struct Attributes: Codable {
let type: String
let url: String
}
let attributes: Attributes