Skip to content

Instantly share code, notes, and snippets.

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

HS Lee hsleedevelop

๐Ÿ”ฅ
View GitHub Profile

Debugging the Swift Toolchain

Use these steps to debug components of the Swift toolchain. This allows you to see Swift's source code from the debugger โ€“ instead of disassembly. The debugger can also provide some variable names and values. This has been initially tested with libswiftCore.dylib.

These instructions were updated as of Swift 5.2.1.

Prerequisites

@hsleedevelop
hsleedevelop / BetterXcodeJumpToCounterpartSwift.org
Created November 20, 2019 06:26 — forked from danielmartin/BetterXcodeJumpToCounterpartSwift.org
Add support for a better Xcode's Jump to Next Counterpart in Swift

If you work on a Swift project that follows the Model-View-ViewModel (MVVM) architecture or similar, you may want to jump to counterpart in Xcode from your view to your model, and then to your view model. (ie. by using Ctrl+Cmd+Up and Ctrl+Cmd+Down).

You can do this in recent versions of Xcode by setting a configuration default.

From a terminal, just type this command and press Enter:

defaults write com.apple.dt.Xcode IDEAdditionalCounterpartSuffixes -array-add "ViewModel" "View"
@hsleedevelop
hsleedevelop / gist:ccaebcb339b8d6ff7904ebe59dba80c0
Created October 11, 2019 03:09 — forked from steipete/ios-xcode-device-support.sh
Using iOS 13.2 devices with Xcode 11.1 (instead of Xcode 11.2) (also, Xcode 10.3)
// 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 13.2 devices (Xcode 11.2) with Xcode 11.1:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.2 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Xcode 10.3 to Xcode 11
sudo ln -s /Applications/Xcode-11.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode-10.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
debugConfig="Debug"
if [ "$debugConfig" != "${CONFIGURATION}" ]; then
echo "Running Crashlytics"
${PROJECT_DIR}/Reader/3rdPartyLibs/Crashlytics.framework/run <uuid here>
fi
@hsleedevelop
hsleedevelop / lldb-debugging.md
Created October 7, 2019 04:46 — forked from alanzeino/lldb-debugging.md
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.

@hsleedevelop
hsleedevelop / Monads.swift
Created May 30, 2019 07:44 — forked from sooop/Monads.swift
Monad in Swift : ๋ชจ๋‚˜๋“œ ๊ฐœ๋…์„ Swift๋กœ ๊ตฌํ˜„ํ•ด๋ณธ๋‹ค.
/*
๋ชจ๋‚˜๋“œ๋Š” ํŠน์ •ํ•œ ํƒ€์ž…์„ ๊ฐ์‹ธ๋Š” ํƒ€์ž…์ด๋ฉฐ,
rawํ•œ ๊ฐ’์„ ๊ฐ์‹ธ๋Š” ํ•จ์ˆ˜์™€
rawํ•œ ๊ฐ’์„ ๋ชจ๋‚˜๋“œ ๊ฐ’์œผ๋กœ ๋ฐ”๊พธ๋Š” ์–ด๋–ค ํ•จ์ˆ˜์— ๋ฐ”์ธ๋”ฉ๋œ๋‹ค.
์ด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋ชจ๋‚˜๋“œ ํ”„๋กœํ† ์ฝœ์„ ์ •์˜ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.
*/
protocol Monad {
@hsleedevelop
hsleedevelop / json.swift
Created March 21, 2019 07:45 — forked from chriseidhof/json.swift
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 {
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation