View Await+Threading.swift
// | |
// Author: Chase Wasden | |
// Website: https://gist.github.com/ccwasden | |
// Licensed under MIT license https://opensource.org/licenses/MIT | |
// | |
import Foundation | |
import Combine | |
// Threading |
View Multiselect.swift
// | |
// Author: Chase Wasden | |
// Website: https://gist.github.com/ccwasden | |
// Licensed under MIT license https://opensource.org/licenses/MIT | |
// | |
import SwiftUI | |
struct Fruit: Selectable { | |
let name: String |
View Multiselect2.swift
// | |
// Author: Chase Wasden | |
// Website: https://gist.github.com/ccwasden | |
// Licensed under MIT license https://opensource.org/licenses/MIT | |
// | |
import SwiftUI | |
struct Fruit: Selectable { | |
let name: String |
View Multiselect3.swift
// | |
// Author: Chase Wasden | |
// Website: https://gist.github.com/ccwasden | |
// Licensed under MIT license https://opensource.org/licenses/MIT | |
// | |
import SwiftUI | |
struct Fruit: Identifiable { | |
let name: String |
View SwiftUI-MultiSelect.swift
struct Cheese: Identifiable { | |
let name: String | |
var isSelected: Bool | |
var id: String { name } | |
} | |
class ViewModel: ObservableObject { | |
@Published var cheeses = [ | |
Cheese(name: "Brie", isSelected: false), | |
Cheese(name: "Cheddar", isSelected: true), |
View WithPopover.swift
// -- Usage | |
struct Content: View { | |
@State var open = false | |
@State var popoverSize = CGSize(width: 300, height: 300) | |
var body: some View { | |
WithPopover( | |
showPopover: $open, | |
popoverSize: popoverSize, |
View automateSandboxTesterEntry.js
// Steps to use: | |
// 1. Go to itunesConnect > Users & Roles | |
// 2. Select "Testers" under the "Sandbox" header on the left | |
// 2. Open the console on your browser (eg. CMD-OPT-J) | |
// 3. Paste the code below (modified to your liking) into the console and hit enter | |
// 4. enter `createUser('desiredEmailAlias')` into the console and watch the user get created automatically | |
// | |
// NOTE: To create several users rapidly: in the console hit the up arrow, change the alias, and hit enter again. Repeat. | |
// Edit the user here to your liking |
View ArrayUtils.swift
func unwrapAndCollapse<T>(array:[T?]) -> [T] { | |
return array.reduce([]) { $1 != nil ? $0 + [$1!] : $0 } | |
} | |
func appendReplacingMatches<T>(first:[T], second:[T], matcher:((T,T)->Bool)) -> [T] { | |
var i = 0 | |
var finalArray = first | |
var appendArray = second | |
while i < first.count && appendArray.count > 0 { | |
let item = appendArray.first! |