Skip to content

Instantly share code, notes, and snippets.

@Adobels
Adobels / gist:1d83193857192dd3bfa93cb5e64859bb
Created September 21, 2023 19:52
Tappable Trapezoids and Rectangle UIView
import UIKit
class ShapeView: UIView {
private var topTrapezoidPath: UIBezierPath!
private var bottomTrapezoidPath: UIBezierPath!
private var leftTrapezoidPath: UIBezierPath!
private var rightTrapezoidPath: UIBezierPath!
private var rectanglePath: UIBezierPath!
created_at: Sun, 11 Jun 2023 13:31:06 GMT, Xcode 15.0.0-beta
Swift-macros quick notes
Related videos:
- [WWDC23 What’s new in Swift](https://developer.apple.com/videos/play/wwdc2023/10164)
- [WWDC23 Write Swift macros](https://developer.apple.com/videos/play/wwdc2023/10166)
- [WWDC23 Expand on Swift macros](https://developer.apple.com/videos/play/wwdc2023/10167)
It looks like:
@Adobels
Adobels / UIKitBuilder.swift
Created May 31, 2023 05:54
UIKitView builder + constraints
//
// ViewController.swift
// pocUIViewBuilder
//
// Created by MaxAir on 26/05/2023.
//
import UIKit
@resultBuilder
struct SubviewBuilder {
import UIKit
@resultBuilder
struct SubviewBuilder {
static func buildEither(first component: UIView) -> UIView {
print(#function + "2")
return component
}
static func buildEither(second component: UIView) -> UIView {
print(#function + "1")
@Adobels
Adobels / gist:8e84091f16ef2c6f1706b30e58aa5f72
Created November 29, 2022 15:49
git: print commits which changed a given file
git log --full-history -1 -- '*IdentifierTextField.swift'
usage examples:
- Find out in which commit a given file was deleted from project
@Adobels
Adobels / gist:0ff6a4f8f5528cc2578591db09fca7f5
Created November 29, 2022 15:46
Terminal: find file names with xib extension and get only file name component
find . -type f -name '*.xib' | rev | cut -d '/' -f1 | rev | cut -d '.' -f1
@Adobels
Adobels / gist:409261b06c4238e38f23a0475401cecd
Last active November 29, 2022 15:40
Xcode regex: find line with commented code
[/]{2}\h*(lazy|private|let|var|func|struct|class|enum|case)
@Adobels
Adobels / gist:5092ed12ddbe15e6fe03f1291213ae84
Created November 29, 2022 15:26
Xcode lldb console: cast object in memory
expr -l Swift -- import UIKit
expr -l Swift -- let $ca = unsafeBitCast(0x6000004c1dc0, to: CALayer.self)
expr -l Swift -- print($ca.borderWidth)
@Adobels
Adobels / gist:72649a612f2bf2913c1f3933c0f49ac9
Created October 8, 2021 12:53
@IBSegueAction method signature
@IBSegueAction private func showPerson(coder: NSCoder, sender: Any?, segueIdentifier: String?)
working variants:
@IBSegueAction private func showPerson(coder: NSCoder)
@IBSegueAction private func showPerson(_ coder: NSCoder, sender: Any?, segueIdentifier: String?)
@IBSegueAction private func showPerson(_ coder: NSCoder)
@IBSegueAction private func showPerson(coder: NSCoder)
2021-09-15 1A291f removes the deployment limit entirely, so all users should now be able to get the firmware update.
2021-09-07 1.0.291 1A291e changed nothing other than the rate limit on the percentage (25%) of ‌AirTags‌ users getting the update
2021-0x-xx 1A291c