Skip to content

Instantly share code, notes, and snippets.

View jaredsinclair's full-sized avatar

Jared Sinclair jaredsinclair

View GitHub Profile

Repackaging a Fat Static Library as an xcframework

Consider this directory tree from a vendor:

OwningTheLibs/
  OwningTheLibs.a
  include/
    OwningTheLibs/
      OwningTheLibs.h

Repackaging a Fat Static Library as an xcframework

Consider this directory tree from a vendor:

OwningTheLibs/
  OwningTheLibs.a
  include/
    OwningTheLibs/
      OwningTheLibs.h
final class NavigationPopTransitionController: UIPercentDrivenInteractiveTransition {
let navigationController: UINavigationController
private lazy var interactivePopGestureRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(handle))
var ifInteractive: Self? {
interactivePopGestureRecognizer.state == .began ? self : nil
}
@propertyWrapper
public struct AnyProxy<EnclosingSelf, Value> {
private let keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>
public init(_ keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>) {
self.keyPath = keyPath
}
@available(*, unavailable, message: "The wrapped value must be accessed from the enclosing instance property.")
public var wrappedValue: Value {
@DevAndArtist
DevAndArtist / reimplemented_parts_of_swiftui.swift
Last active May 29, 2023 14:55
This is a custom implementation of some parts of SwiftUI which I could observe.
import CoreGraphics
final class TransactionStack {
static let shared = TransactionStack()
private var _transactions: [Transaction]
private init() {
dispatchPrecondition(condition: .onQueue(.main))
_transactions = []
@cellularmitosis
cellularmitosis / EmojiPointersDemo.swift
Created August 15, 2018 18:11
Representing pointer values as emoji can be useful for "visually" debugging certain issues, like cell reuse, etc.
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
@deepakraj27
deepakraj27 / DPImageView+LettersExtension.swift
Created June 25, 2018 18:08
An easy, helpful UIImageView category that generates letter initials as a placeholder for user images, with a custom background color and double border with custom stroke width Completely supports SWIFT 4 and SWIFT 3, written excusively for you.
//
// UIImageView+Letters.swift
// UIImageViewLettersDemo
//
// Created by Deepakraj Murugesan on 23/02/18.
// Copyright © 2018 Deepak. All rights reserved.
//
import Foundation
import UIKit
@dmathewwws
dmathewwws / gist:348d55d3d9cdcb61a1afc66ea3bafcad
Created December 1, 2017 17:09
Info.plist for XML / OPML Document types
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Echo-Icon.png</string>
@khanlou
khanlou / Collection+Chunking.swift
Last active December 23, 2020 02:00
Collection chunking via @timvermeulen
extension Collection {
func chunk(size: Int) -> ChunkedCollection<Self> {
ChunkedCollection(self, size: size)
}
}
struct ChunkedCollection<Base: Collection>: Collection {
private let base: Base
@kevpl
kevpl / setup-vmware-image-with-static-IP.md
Created July 5, 2017 16:36 — forked from rishijavia/setup-vmware-image-with-static-IP.md
VMWare Fusion Images with a static IP Address on Mac OS Sierra 10.12.5

How to setup your VMWare Fusion images to use static IP addresses on Mac OS X

When you're just configuring a single server, having a static IP address for your server image isn't too important, but when you're configuring multi-server setups, it can be useful to duplicate a number of server images and give each a static IP address so you can consistently deploy to them. While not documented well at all, it turns out that this is relatively easy to accomplish in four simple steps.

1. Determine the MAC address of your guest machine

Let's say you have a guest machine with the name ubuntu-lucid-lynx-base and you keep your guest machine images in ~/Documents/Virtual\ Machines/. To determine the MAC address for this VM, you can run:

cat ~/Documents/Virtual\ Machines/ubuntu-lucid-lynx-base.vmwarevm/ubuntu-lucid-lynx-base.vmx | grep ethernet0.generatedAddress