Skip to content

Instantly share code, notes, and snippets.

@DougGregor
DougGregor / SwiftConcurrencyDependencies.svg
Created December 2, 2020 00:39
Swift Concurrency Proposal Dependencies
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jordansinger
jordansinger / iPod.swift
Created July 27, 2020 21:19
Swift Playgrounds iPod Classic
import SwiftUI
import PlaygroundSupport
struct iPod: View {
var body: some View {
VStack(spacing: 40) {
Screen()
ClickWheel()
Spacer()
}
// Original article here: https://www.fivestars.blog/code/swiftui-hierarchy-list.html
import SwiftUI
struct FileItem: Identifiable {
let name: String
var children: [FileItem]?
var id: String { name }
//------------------------------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths)
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect)
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier)
//------------------------------------------------------------------------
import SwiftUI
struct ContentView: View {
@alsedi
alsedi / gist:64954a98bd44d1b5675002b3781f0954
Created April 5, 2018 15:02
UIView+SizeConstraints.Swift
import Foundation
extension UIView {
func height(constant: CGFloat) {
setConstraint(value: constant, attribute: .height)
}
func width(constant: CGFloat) {
setConstraint(value: constant, attribute: .width)
}
@lattner
lattner / TaskConcurrencyManifesto.md
Last active April 21, 2024 09:43
Swift Concurrency Manifesto
@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@sooop
sooop / StreamReader.swift
Last active May 28, 2023 13:00
Read a large text file line by line - Swift 3
import Foundation
class StreamReader {
let encoding: String.Encoding
let chunkSize: Int
let fileHandle: FileHandle
var buffer: Data
let delimPattern : Data
var isAtEOF: Bool = false
@skreutzberger
skreutzberger / sen_swiftbe_dev.md
Last active December 2, 2019 15:07
Senior Swift Backend Developer (Freelance, 100% Remote)

Senior Swift Backend Developer (Freelance, 100% Remote)

I am searching experienced backend developers (freelance, remote) with a ❤️ for Swift for Moonshot Energy, the world’s first AI-driven renewable energy company located in Germany. Moonshot Energy is financially backed by Innogy SE, one of Europe's largest energy providers.

At Moonshot you will play a major role in making the world greener, the future brighter and energy distribution smarter by using latest technologies like server-side Swift, microservices, artificial intelligence 🤖 and machine learning and new interfaces like chatbots and dialog-based systems (NLP).

Since our team is working on European timezones it would be good if you would live in the EU or if you are an early bird living in US-East 🇪🇺🇺🇸.

Your job:

  • build our internal microservices
@bishalg
bishalg / UIView+Extension.swift
Created May 5, 2016 03:27
Swift UIView Extension for Inspectable CornerRadius, BorderWidth and BoarderColors etc
//
// UIView+Extension.swift
//
// Created by Bishal Ghimire on 4/30/16.
// Copyright © 2016 Bishal Ghimire. All rights reserved.
//
import UIKit
//