Skip to content

Instantly share code, notes, and snippets.

View stleamist's full-sized avatar

Dongkyu Kim stleamist

View GitHub Profile
@levitatingpineapple
levitatingpineapple / UIFont.Features.swift
Last active August 1, 2024 10:10
SFPro Font Features
import UIKit
extension UIFont {
/// Watch [WWDC Session](https://developer.apple.com/videos/play/wwdc2015/804/).
/// [Font Feature Registry](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html)
/// - Parameters:
/// - size: The size (in points) to which the font is scaled. This value must be greater than 0.0.
/// - weight: The weight of the font, specified as a font weight constant.
/// - features: Font features supported by SFPro
@ole
ole / !swiftui-reflection-dump.md
Last active November 24, 2024 03:26
A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.

A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.

Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around. Because of ABI stability, I don't think the swift-reflection-dump version has to match the compiler version that was used to build the binary, but I'm not 100% sure.

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x00007fff3cdc3c01 SwiftUI`outlined consume of SwiftUI.GraphicsImage.Contents + 1
frame #1: 0x00007fff3d5ba75c SwiftUI`static SwiftUI.GraphicsImage.== infix(SwiftUI.GraphicsImage, SwiftUI.GraphicsImage) -> Swift.Bool + 412
frame #2: 0x00007fff3cf68b41 SwiftUI`static SwiftUI.Image.Resolved.== infix(SwiftUI.Image.Resolved, SwiftUI.Image.Resolved) -> Swift.Bool + 465
frame #3: 0x00007fff45a81acf AttributeGraph`AGDispatchEquatable + 15
* frame #4: 0x00007fff45a6e114 AttributeGraph`AG::LayoutDescriptor::compare(unsigned char const*, unsigned char const*, unsigned char const*, unsigned long, unsigned int) + 1637
frame #5: 0x00007fff45a7a40e AttributeGraph`AGGraphSetOutputValue + 445
frame #6: 0x00007fff3d17f12e SwiftUI`generic specialization <SwiftUI.Image> of SwiftUI.(EnvironmentReadingChild in _FB65686E4F4C246132C16AE349C5E43C).updateValue() -> () + 1838
frame #7: 0x00007fff3d28edef SwiftUI
@jordansinger
jordansinger / macOS.swift
Last active November 17, 2024 02:37
macOS SwiftUI Playgrounds code
import SwiftUI
import PlaygroundSupport
struct Desktop: View {
var body: some View {
ZStack {
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG"))
Color(UIColor.systemBlue)
macOS()
}
@jhays
jhays / BluetoothManager.swift
Created June 4, 2020 15:36
A comparison of reading from a BLE peripheral using the CoreBluetooth standard delegation pattern, and RxBluetoothKit's reactive pattern. Notice the difference in total lines of code to accomplish a single read...
//
// BluetoothManager.swift
// BluetoothExample
//
// Created by Julian Hays on 5/26/20.
// Copyright © 2020 PunchThrough. All rights reserved.
//
import Foundation
import CoreBluetooth
@uchcode
uchcode / safariview.swift
Created March 28, 2020 15:55
SwiftUI with UIViewController Design Pattern.
import SwiftUI
import SafariServices
struct DemoView: View, Hostable {
@EnvironmentObject var hostedObject: HostingObject<DemoView>
var address: String = "https://example.com"
func present() { // UIKit code
let safari = SFSafariViewController(url: URL(string: address)!)
@chosa91
chosa91 / AutoLayout.md
Created February 8, 2020 09:53 — forked from oliverkrakora/AutoLayout.md
The best damn AutoLayout guide I've ever seen

ℹ️ This article is also available on his blog.


Fundamentals

Layout and Drawing are two different things:

  • Layout defines only the positions and sizes of all views on screen.
  • Drawing specifies how each view is rendered (how it looks).
@oliverkrakora
oliverkrakora / AutoLayout.md
Created February 4, 2020 19:27 — forked from NSExceptional/AutoLayout.md
The best damn AutoLayout guide I've ever seen

ℹ️ This article is also available on his blog.


Fundamentals

Layout and Drawing are two different things:

  • Layout defines only the positions and sizes of all views on screen.
  • Drawing specifies how each view is rendered (how it looks).