Skip to content

Instantly share code, notes, and snippets.

View hsleedevelop's full-sized avatar
๐Ÿ”ฅ

HS Lee hsleedevelop

๐Ÿ”ฅ
View GitHub Profile
@asmallteapot
asmallteapot / Dictionary.Value+RangeReplaceableCollection.swift
Last active March 28, 2023 07:40
Swift: Append an element to an array in a dictionary value, creating the array/value if needed
import Foundation
extension Dictionary where Value: RangeReplaceableCollection {
public mutating func append(element: Value.Iterator.Element, toValueOfKey key: Key) -> Value? {
var value: Value = self[key] ?? Value()
value.append(element)
self[key] = value
return value
}
}
public protocol PaginationServiceType {
associatedtype Element
init(elementProvider: (page: Int, numberOfElements: Int) -> SignalProducer<[Element], NoError>)
func fetchNextPage(numberOfElements: Int) -> SignalProducer<[Element], NoError>
}
@steipete
steipete / ios-xcode-device-support.sh
Last active May 11, 2025 13:30
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@alanzeino
alanzeino / lldb-debugging.md
Last active April 30, 2025 19:32
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

@chriseidhof
chriseidhof / json.swift
Last active March 21, 2019 07:45
Reflection
import Cocoa
struct Person {
var name: String = "John"
var age: Int = 50
var dutch: Bool = false
var address: Address? = Address(street: "Market St.")
}
struct Address {
@yamaya
yamaya / xcode-swift-vers
Last active May 6, 2025 13:57
Xcode swift version record
# Xcode 6.2 (6C131e)
Swift version 1.1 (swift-600.0.57.4)
Target: x86_64-apple-darwin14.1.0
# Xcode 6.3 (6D570)
Apple Swift version 1.2 (swiftlang-602.0.49.3 clang-clang-602.0.49)
Target: x86_64-apple-darwin14.1.0
# Xcode 6.3.1 (6D1002)
Apple Swift version 1.2 (swiftlang-602.0.49.6 clang-602.0.49)
@davbeck
davbeck / WKUIDelegate.m
Last active September 28, 2023 06:59
Boilerplate implementation of WKUIDelegate to support Javascript alerts.
#pragma mark - WKUIDelegate
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)())completionHandler
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
completionHandler();
@sooop
sooop / Monads.swift
Last active February 3, 2020 16:20
Monad in Swift : ๋ชจ๋‚˜๋“œ ๊ฐœ๋…์„ Swift๋กœ ๊ตฌํ˜„ํ•ด๋ณธ๋‹ค.
/*
๋ชจ๋‚˜๋“œ๋Š” ํŠน์ •ํ•œ ํƒ€์ž…์„ ๊ฐ์‹ธ๋Š” ํƒ€์ž…์ด๋ฉฐ,
rawํ•œ ๊ฐ’์„ ๊ฐ์‹ธ๋Š” ํ•จ์ˆ˜์™€
rawํ•œ ๊ฐ’์„ ๋ชจ๋‚˜๋“œ ๊ฐ’์œผ๋กœ ๋ฐ”๊พธ๋Š” ์–ด๋–ค ํ•จ์ˆ˜์— ๋ฐ”์ธ๋”ฉ๋œ๋‹ค.
์ด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋ชจ๋‚˜๋“œ ํ”„๋กœํ† ์ฝœ์„ ์ •์˜ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.
*/
protocol Monad {
@bobspryn
bobspryn / preferredFontDescriptorWithTextStyle sizes and styles
Created December 11, 2013 01:12
Apple iOS7 sizes and traits for all UIFontTextStyle's and UIContentSizeCategory's
UIContentSizeCategoryExtraSmall
FontStyle: UICTFontTextStyleBody
Point size 14.000000
Family Name .AppleSystemUIBody
FontStyle: UICTFontTextStyleHeadline
Point size 14.000000
Family Name .AppleSystemUIHeadline
Bold
FontStyle: UICTFontTextStyleSubhead
Point size 12.000000