Skip to content

Instantly share code, notes, and snippets.

View akbashev's full-sized avatar
🐢
Slowly learning stuff

Jaleel Akbashev akbashev

🐢
Slowly learning stuff
View GitHub Profile
@tcldr
tcldr / ConcurrencyUtilities.swift
Last active April 23, 2023 12:48
Swift Concurrency Utilities for managing Transactional Resources
// A simple serial queue. Every operation sent through the queue will be executed
// in first-in first-out order. Every operation will complete its execution fully,
// even if it includes suspension points, prior to the next operation commencing.
//
// TIP: If calling from a global actor like @MainActor annotate your closure to
// get better ergonomics: `queue.send { @MainActor in /* ... */ }`
public final class AsyncSerialQueue: Sendable {
@rjchatfield
rjchatfield / Promised.swift
Last active August 29, 2022 18:50
Promised values in Swift Concurrency
/// Wrapper around a lazily resolved using checked continuation.
///
/// Usage:
///
/// ```
/// let promiseA = Promised<String>()
/// async let a1 = promiseA.value
/// promiseA.resolve("AAA")
/// let a2 = await promiseA.value
/// print(await a1, a2)
@marcedwards
marcedwards / displaysizes.txt
Last active November 16, 2023 06:52
iPhone, iPad, and Apple Watch display sizes
### Points and display type
PPI is points per inch below, not pixels per inch. Not all models are listed, just the first model with a new display size. Diamond, RGB Stripe and Pentile RGB refer to the subpixel patterns.
iPhone 1 = 320×480 at 163PPI sRGB IPS LCD RGB Stripe
iPhone 4 = 320×480 at 163PPI sRGB IPS LCD RGB Stripe
iPhone 5 = 320×568 at 163PPI sRGB IPS LCD RGB Stripe
iPhone 6 = 375×667 at 163PPI sRGB IPS LCD RGB Stripe
iPhone 6 Plus = 414×736 at 153.5PPI sRGB IPS LCD RGB Stripe
iPhone 7 = 375×667 at 163PPI P3 IPS LCD RGB Stripe
@GeorgeLyon
GeorgeLyon / Rust vs. Swift.md
Last active April 4, 2024 21:16
A list of advantages Swift has over Rust

Note This is a little out of date. Rust has made some progress on some points, however many points still apply.

Philosophy

Progressive disclosure

Swift shares Rust's enthusiasm for zero-cost abstractions, but also emphasizes progressive disclosure. Progressive disclosure requires that language features should be added in a way that doesn't complicate the rest of the language. This means that Swift aims to be simple for simple tasks, and only as complex as needed for complex tasks.

The compiler works for you

@ohad7
ohad7 / Tweaks.swift
Last active August 22, 2019 11:49
Mixpanel A/B Testing in Swift
//
// Copyright (c) 2015 Nexar Inc. - All Rights Reserved. Proprietary and confidential.
//
// Unauthorized copying of this file, via any medium is strictly prohibited.
import Foundation
import Mixpanel
public class Tweaks : NSObject, MPTweakObserver {
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit