Skip to content

Instantly share code, notes, and snippets.

View v-i-s-h-a-l's full-sized avatar
👨‍💻

v-i-s-h-a-l v-i-s-h-a-l

👨‍💻
View GitHub Profile
@ryanpato
ryanpato / XCUIElement+Wait.swift
Last active January 4, 2024 04:05
XCUIElement+Wait
//
// XCUIElement+Wait.swift
//
// Created by Ryan Paterson on 12/12/2020.
//
import XCTest
extension XCUIElement {
/// The period of time in seconds to wait explicitly for expectations.
@liorazi
liorazi / Animation+CustomTimingFunctions.swift
Last active February 7, 2024 01:01
Extension to SwiftUI Animation which extends it with more ease timing functions as described in: https://easings.net
import SwiftUI
extension Animation {
public static func easeInSin(duration: Double) -> Animation {
return self.timingCurve(0.47, 0, 0.745, 0.715, duration: duration)
}
public static var easeInSin: Animation = Animation.timingCurve(0.47, 0, 0.745, 0.715)
@lsavino
lsavino / compilation-optimization.md
Last active July 27, 2022 17:44
Compiler Optimizations, Compiling Optimally, and Whole Modules

DEPRECATED for Xcode 10 🎈

(check out What's New in Swift at 11:40, slide 42)

Whole Module Compilation Optimizations: Why these terms are sometimes misleading

When you look up how to compile swift faster for debug builds, people very earnestly give advice that seems contradictory: you should "try using the whole module optimization flag," and also "never use whole module optimization for debugging". [^1]

This is confusing because some of us are using these two general words:

compilation: "turning text into an executable program"

@andreacipriani
andreacipriani / Bash.swift
Last active February 15, 2024 12:50
Execute shell/bash commands from Swift
import UIKit
protocol CommandExecuting {
func run(commandName: String, arguments: [String]) throws -> String
}
enum BashError: Error {
case commandNotFound(name: String)
}
@brynbodayle
brynbodayle / gist:de70eb6a392e90272707
Created July 25, 2014 16:29
Multiline UIButton + Auto Layout
- (CGSize)intrinsicContentSize {
CGSize boundingSize = CGSizeMake(self.titleLabel.preferredMaxLayoutWidth - self.titleEdgeInsets.left - self.titleEdgeInsets.right, CGFLOAT_MAX);
NSAttributedString *attributedTitle = [self attributedTitleForState:self.state];
CGRect boundingRect;
if(attributedTitle) {