async/await
and Structured Concurrency introduce the syntactical building blocks (including theTask
type) for writing asynchronous code using Swift-native language features.- There is a WIP standalone proposal to add
async let
syntax to greatly reduce a pain point of filling values asynchronously for later use. actor
types introduce a new top-level reference type (likeclass
) that require and statically enforce that access to any of their mutable state be done asynchronously (such as by using the async/await syntax), and exist to help model thread-safe mutable data structures. The idea of [global actors](https://github
View StructuredConcurrencyProposals.md
View paste
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
“_wrappers.so” cannot be opened because the developer cannot be verified. |
View paste
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
https://gist.github.com/70547c03a0df58b349eed8d600fced9b |
View paste
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 | |
@propertyWrapper public struct Percentage<Value: FloatingPoint> { | |
private var storage: Value | |
private let upperBound: Value | |
public init(wrappedValue: Value, upperBound: Value = (1.0 as! Value)) { | |
self.storage = wrappedValue | |
self.upperBound = upperBound |
View PickWeighted.swift
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
/// Pseudorandomly choose a value from an array of values, where each is weighted relative to the others in the collection. | |
/// | |
/// The `weight` component of each tuple is a positive integer signalling how likely a value is to be chosen vs. other values with different weights. For example, a value with a weight of `4` is four times as likely as a value with a weight of `1` to be chosen. | |
/// | |
/// - Parameter values: an array of `(value:Thing,weight:Int)` tuples. | |
/// | |
/// - Returns: a single chosen value. | |
/// | |
func pickWeighted<Thing>(from weightedValues: [(value: Thing, weight: Int)]) -> Thing { | |
// compute the sum of the weights of all of the value/weight pairs |
View CreateMLOutput.txt
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
Image augmentation option 'exposure' selected. | |
Image augmentation option 'shear' selected. | |
Automatically generating validation set from 10% of the data. | |
Extracting augmented image features from training data set. | |
Analyzing and extracting image features. | |
+----------------------+------------------+--------------+------------------+ | |
| Raw Images Processed | Augmented Images | Elapsed Time | Percent Complete | | |
+----------------------+------------------+--------------+------------------+ | |
| 1 | 16 | 2.31s | 2% | | |
| 2 | 32 | 2.98s | 4% | |
View zip3.swift
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
struct Zip3Iterator | |
< | |
A: IteratorProtocol, | |
B: IteratorProtocol, | |
C: IteratorProtocol | |
>: IteratorProtocol { | |
private var first: A | |
private var second: B |
View DragTableController.swift
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
// | |
// ViewController.swift | |
// DragTable | |
// | |
// Created by Anna Kim on 2017. 2. 9.. | |
// Copyright © 2017년 Anna Kim. All rights reserved. | |
// | |
import Cocoa |
View UserDefault.swift
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
// | |
// UserDefault.swift | |
// | |
// Created by Michael L. Ward on 5/29/17. | |
// Copyright © Michael L. Ward. All rights reserved. | |
// | |
import Foundation | |
struct UserDefault<T> { |
View ImageStore.swift
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
// | |
// Copyright © 2015 Big Nerd Ranch | |
// | |
import UIKit | |
class ImageStore { | |
let cache = NSCache<NSString, UIImage>() | |
NewerOlder