This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612) | |
| // clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m | |
| // | |
| // If SIP off: | |
| // DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari | |
| // | |
| // If SIP on, you can demo this by manually removing Safari's code signing signature, but many | |
| // features (eg saved logins) won't be readable by the resigned app: | |
| // cp -a /Applications/Safari.app ./ | |
| // codesign --remove Safari.app/Contents/MacOS/Safari |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Public domain - https://gist.github.com/nolanw/dff7cc5d5570b030d6ba385698348b7c | |
| import Foundation | |
| extension URLRequest { | |
| /** | |
| Configures the URL request for `multipart/form-data`. The request's `httpBody` is set, and a value is set for the HTTP header field `Content-Type`. | |
| - Parameter parameters: The form data to set. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Excerpt from https://github.com/krzyzanowskim/CoreTextWorkshop | |
| // Licence BSD-2 clause | |
| // Marcin Krzyzanowski marcin@krzyzanowskim.com | |
| func getSizeThatFits(_ attributedString: NSAttributedString, maxWidth: CGFloat) -> CGSize { | |
| let framesetter = CTFramesetterCreateWithAttributedString(attributedString) | |
| let rectPath = CGRect(origin: .zero, size: CGSize(width: maxWidth, height: 50000)) | |
| let ctFrame = CTFramesetterCreateFrame(framesetter, CFRange(), CGPath(rect: rectPath, transform: nil), nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import Foundation | |
| // NOTE: This playground shows how to use Swift's AttributedString with Markdown. | |
| // | |
| // This code was used to display Markdown content in the Tot iOS Widget <https://tot.rocks> | |
| // MARK: - Helpful Links | |
| // NOTE: The following links helped me figure this stuff out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // UICollectionView Objective-C example | |
| - (void)viewWillAppear:(BOOL)animated { | |
| [super viewWillAppear:animated]; | |
| NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
| if (selectedIndexPath != nil) { | |
| id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
| if (coordinator != nil) { | |
| [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import Charts | |
| import PlaygroundSupport | |
| let spiData: [(package: String, fileCount: Int, mbSize: Int)] = [ | |
| (package: "swift-markdown-ui", fileCount: 3796, mbSize: 44), | |
| (package: "Microya", fileCount: 414, mbSize: 4), | |
| (package: "swift-url-routing", fileCount: 9430, mbSize: 101), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This file is based largely on the Runtime package - https://github.com/wickwirew/Runtime | |
| extension KeyPath { | |
| var fieldName: String? { | |
| guard let offset = MemoryLayout<Root>.offset(of: self) else { | |
| return nil | |
| } | |
| let typePtr = unsafeBitCast(Root.self, to: UnsafeMutableRawPointer.self) | |
| let metadata = typePtr.assumingMemoryBound(to: StructMetadata.self) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // FreeSpaceViewController.swift | |
| // Free Space | |
| // | |
| // Created by Kyle Howells on 04/05/2022. | |
| // | |
| import UIKit | |
| class FreeSpaceViewController: UIViewController { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final class Loader: BindableObject { | |
| let didChange = PassthroughSubject<Data?, Never>() | |
| var task: URLSessionDataTask! | |
| var data: Data? = nil { | |
| didSet { | |
| didChange.send(data) | |
| } | |
| } | |
| init(_ url: URL) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ContentView.swift | |
| // TestingMoreSwiftUI | |
| // | |
| // Created by Chris Eidhof on 04.06.19. | |
| // Copyright © 2019 Chris Eidhof. All rights reserved. | |
| // | |
| import SwiftUI | |
| import Combine |
NewerOlder