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
| // Excerpt from https://github.com/krzyzanowskim/CoreTextWorkshop | |
| // Licence BSD-2 clause | |
| // Marcin Krzyzanowski [email protected] | |
| 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
| Key Name Description | |
| ======== =========== | |
| 3GProximityCapability Whether the device has a 3G proximity sensor | |
| 3GVeniceCapability Whether the device supports FaceTime over cellular | |
| 720pPlaybackCapability Whether the device supports 720p video (identical to kMGQDeviceSupports720p) | |
| APNCapability | |
| ARM64ExecutionCapability Whether the device supports executing arm64 binaries | |
| ARMV6ExecutionCapability Whether the device supports executing armv6 binaries | |
| ARMV7ExecutionCapability Whether the device supports executing armv7 binaries | |
| ARMV7SExecutionCapability Whether the device supports executing armv7s binaries |
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 Combine | |
| public struct ChangeObserver<V: Equatable>: ViewModifier { | |
| public init(newValue: V, action: @escaping (V) -> Void) { | |
| self.newValue = newValue | |
| self.newAction = action | |
| } | |
| private typealias Action = (V) -> Void |
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
| // Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e | |
| // by @levelsio | |
| // HOW TO | |
| // 1) Make a Google Sheet, we'll pull the first cell e.g. A1 | |
| // 2) Publish your Google Sheet, File -> Publish To Web | |
| // 3) Copy the SHEET_ID in the URL, put it in here below: | |
| const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json" | |
| // 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188 | |
| // 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc) |
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
| const ethGasStationApiUrl = `https://ethgasstation.info/api/ethgasAPI.json`; | |
| const req = new Request(ethGasStationApiUrl); | |
| const res = await req.loadJSON(); | |
| if (config.runsInWidget) { | |
| const widget = new ListWidget(); | |
| const title = widget.addText("Gas Prices"); | |
| title.textColor = Color.white(); | |
| title.textOpacity = 0.8; |
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
| extension UIHostingController { | |
| convenience public init(rootView: Content, ignoreSafeArea: Bool) { | |
| self.init(rootView: rootView) | |
| if ignoreSafeArea { | |
| disableSafeArea() | |
| } | |
| } | |
| func disableSafeArea() { |
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 PlaygroundSupport | |
| struct Sunset: View { | |
| @State var backgroundColor = Color.blue | |
| @State var sunSetted = false | |
| let sunGradient = [Color.yellow, Color.orange] | |
| let moonGradient = [Color.gray, Color.black] | |
| @State var alignment = Alignment.top | |
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
| # A Best in Class Checklist | |
| A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10. | |
| > To use this, create a Github Issue in your own repo, and simply copy and paste this text. | |
| ## iOS Core Technology | |
| _Things any iOS app can benefit from_ | |
| - [ ] iCloud Sync | |
| - [ ] Focus Filter Support |
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
| // Run any SwiftUI view as a Mac app. | |
| import Cocoa | |
| import SwiftUI | |
| NSApplication.shared.run { | |
| VStack { | |
| Text("Hello, World") | |
| .padding() | |
| .background(Capsule().fill(Color.blue)) |