This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I needed to fetch all the pages from a paged endpoint. | |
// In this specific case, the JSON results contained a `pagingStatus` section that provided extra information which I could use: | |
// Hiding that behind a protocol: | |
import Foundation | |
protocol PagedReturning { | |
var pagingStatus: PagingStatus { get } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
struct Desktop: View { | |
var body: some View { | |
ZStack { | |
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG")) | |
Color(UIColor.systemBlue) | |
macOS() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
struct Keypad: View { | |
var body: some View { | |
VStack(spacing: 24) { | |
HStack { | |
Spacer() | |
Text("1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
// constants | |
let deviceWidth: CGFloat = 320 | |
let deviceHeight: CGFloat = 568 | |
let hasFaceID = true // false for TouchID | |
struct Device: View { | |
var body: some View { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
struct Content: View { | |
@State var isExpanded = false | |
@State var wifiEnabled = true | |
@State var spacing: CGFloat = 12 | |
var body: some View { | |
VStack(spacing: self.spacing) { | |
HStack(spacing: self.spacing) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import SafariServices | |
import PlaygroundSupport | |
// lil news api | |
let apiURL = "https://api.lil.software/news" | |
struct News: Codable { | |
var articles: [Article] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TipsView.swift | |
// Stonks | |
// | |
// Created by Paul Stamatiou on 7/3/20. | |
// | |
import SwiftUI | |
import PlaygroundSupport |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
// NOTE: this example currently only works with US-based coordinates | |
// constants | |
// New York | |
let latitude = 40.709335 | |
let longitude = -73.956558 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
// constants | |
let cardWidth: CGFloat = 343 | |
let cardHeight: CGFloat = 212 | |
let spacing = 36 | |
let animation = Animation.spring() | |
let cardColors = [ | |
Color(UIColor.systemRed), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to download all the WWDC 2020 session videos in the highest 4K video and audio | |
# You may have to update ffmpeg before using this script. I needed version 4.3 or higher to successfully download the videos. | |
# | |
# If you want the lower bitrate audio, do a find/replace of "audio_english_192" with "audio_english_64" | |
# If you want lower bitrate or lower resolution video, do a find/replace of "hvc_2160p_16800" with any of the following: | |
# "hvc_2160p_11600" | |
# "hvc_1440p_8100" | |
# "hvc_1080p_5800" | |
# "hvc_1080p_4500" | |
# "hvc_720p_3400" |