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 minimal iOS app set up entirely in code using Objective-C rather than using a storyboard and UIApplicationSceneManifest in the Info.plist. | |
| // Last updated for iOS 18. | |
| // Swift version: https://gist.github.com/douglashill/b8125f7e2336b6a47461df0d4898f64d | |
| @import UIKit; | |
| @interface SceneDelegate : UIResponder <UIWindowSceneDelegate> | |
| @end | |
| @implementation SceneDelegate |
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
| // Douglas Hill, November 2023 | |
| // This file is made available under the MIT license included at the bottom of this file. | |
| // `@testable` needed to access `_data` | |
| @testable import Markdown // This package: https://github.com/apple/swift-markdown | |
| /// Writes a Markdown document to HTML. | |
| /// | |
| /// The primary goal is for output to match the output of Markdown.pl 1.0.1 as closely as possible. | |
| /// <https://daringfireball.net/projects/markdown/> |
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
| #! /usr/bin/swift | |
| // Douglas Hill, March 2020 | |
| /* | |
| Extracts the most common translations from Apple’s glossary files. | |
| This script helped with localisation for KeyboardKit (https://github.com/douglashill/KeyboardKit) by leveraging Apple’s existing translations. | |
| More detail in the article at https://douglashill.co/localisation-using-apples-glossaries/ |
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
| #! /usr/bin/swift | |
| // Douglas Hill, March 2020 | |
| // This file is made available under the MIT license included at the bottom of this file. | |
| /* | |
| Extracts specific localised strings from Apple’s glossary files. | |
| This script helped with localisation for KeyboardKit (https://github.com/douglashill/KeyboardKit) by leveraging Apple’s existing translations. |
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
| #! /usr/bin/swift | |
| // Douglas Hill, March 2020 | |
| // Prints out translations from Apple’s glossary files matching text in a supplied English .strings file. | |
| // More detail in the article at https://douglashill.co/localisation-using-apples-glossaries/ | |
| import Foundation | |
| let stringsSource = URL(fileURLWithPath: "PUT THE PATH TO YOUR ENGLISH .strings FILE HERE") |
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 minimal iOS UIKit app set up entirely in code rather than using a storyboard and UIApplicationSceneManifest in the Info.plist. | |
| // Last updated for iOS 18. | |
| import UIKit | |
| class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
| private var _window: UIWindow? | |
| func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
| let window = UIWindow(windowScene: scene as! UIWindowScene) |
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 | |
| class FourColumnsContainerViewController: UIViewController { | |
| let outerSplitViewController = UISplitViewController(style: .tripleColumn) | |
| let innerSplitViewController = UISplitViewController(style: .doubleColumn) | |
| let primary = makeContentViewController("App") | |
| let secondary = makeContentViewController("Files") | |
| let mainContent = makeContentViewController("File Content") | |
| let inspector = makeContentViewController("Inspector") |
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
| // Avoids the keyboard in a UIKit app by leveraging additionalSafeAreaInsets. | |
| // You can put this in the root view controller so the whole app will avoid the keyboard. | |
| // Only tested on iOS 13.3. | |
| // Made for https://douglashill.co/reading-app/ | |
| @objc func updateSafeAreaForKeyboardFromNotification(_ notification: Notification) { | |
| guard let endFrameInScreenCoords = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else { | |
| return | |
| } | |
| // Please consider whether the force unwrap here is safe for your own use case. |
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
| // Douglas Hill, December 2018 | |
| // Made for https://douglashill.co/reading-app/ | |
| // Find the latest version of this file at https://github.com/douglashill/KeyboardKit | |
| import UIKit | |
| /// A table view that allows navigation and selection using a hardware keyboard. | |
| /// Only supports a single section. | |
| class KeyboardTableView: UITableView { | |
| // These properties may be set or overridden to provide discoverability titles for key commands. |
NewerOlder