This file contains 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
//: Playground - noun: a place where people can play | |
import Foundation | |
func numberOfVowels(in string: String) -> Int { | |
var numberOfVowels = 0 | |
for vowel in string.lowercased() { | |
switch vowel { | |
case "a", "e", "i", "o", "u": | |
numberOfVowels = numberOfVowels + 1 |
This file contains 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
func makeChangeAsString(fromAmount amount: Double, withCost cost: Double) -> String { | |
let change = amount - cost | |
let dollars: Int | |
var changeRemaining: Double = 0 | |
(dollars, changeRemaining) = getCoinCount(1.0, fromChange: change) | |
let quarters: Int | |
(quarters, changeRemaining) = getCoinCount(0.25, fromChange: changeRemaining) | |
let dimes: Int | |
(dimes, changeRemaining) = getCoinCount(0.1, fromChange: changeRemaining) |
This file contains 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
// | |
// main.m | |
// Space Age | |
// | |
// Created by Michael Redig on 10/9/19. | |
// Copyright © 2019 Red_Egg Productions. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains 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
// This causes a retain cycle on `vc` | |
var vc: UIViewController? | |
let myNewSUIView = ASwiftUIView( | |
completion: { url in | |
vc?.dismiss(animated: true) | |
}) | |
let hostingController = UIHostingController(rootView: myNewSUIView) |
This file contains 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 Foundation | |
/** | |
Since `Task`s are not guaranteed to execute in the order they are created, yet it is sometimes important for them to be completed in order, this actor allows for you to | |
add async closures to a queue in which the order is FIFO. | |
*/ | |
public actor AsyncTaskQueue { | |
public typealias TaskType = Task<Void, Error> | |
public private(set) var currentTask: TaskType? { | |
didSet { |
This file contains 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
#! /usr/bin/python3 | |
# | |
# File: SMJobBlessUtil.py | |
# | |
# Contains: Tool for checking and correcting apps that use SMJobBless. | |
# | |
# Written by: DTS | |
# | |
# Copyright: Copyright (c) 2012 Apple Inc. All Rights Reserved. | |
# |
This file contains 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 Foundation | |
/// Makes an Encodable and Decodable properties encode to `null` instead of omitting the value altogether. | |
@propertyWrapper | |
public struct NullCodable<T> { | |
public var wrappedValue: T? | |
public init(wrappedValue: T?){ | |
self.wrappedValue = wrappedValue | |
} |
OlderNewer