Skip to content

Instantly share code, notes, and snippets.

View StewartLynch's full-sized avatar

Stewart Lynch StewartLynch

View GitHub Profile
import Foundation
// Here is the codable model that I am trying to decode the feed into
struct Feed: Codable {
let items: [Items]
let pageInfo: PageInfo
let nextPageToken: String?
}
struct PageInfo: Codable {
import Foundation
struct SalesForce: Codable {
struct Records: Codable {
struct Attributes: Codable {
let type: String
let url: String
}
let attributes: Attributes
//
// DebugPrint.swift
// Deep Links Test
//
// Created by Stewart Lynch on 2021-02-09.
//
import Foundation
enum DebugPrint {
@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 {
@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 / 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 / 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]
struct NewsFeed: Decodable {
let kind: String
let data: OuterData
struct OuterData: Decodable {
let children: [Child]
}
struct Child: Decodable {
let data: InnerData
@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",
@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.",