This file contains 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 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
// `@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/> | |
/// | |
/// Usage: | |
/// |
This file contains 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; | |
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate> | |
@end | |
@implementation SceneDelegate | |
@synthesize window = _window; | |
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { |
This file contains 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 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. |
This file contains 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 URL { | |
/// Splits a URL that might have a fragment into the URL with the fragment removed and the fragment text. | |
/// | |
/// If there is no fragment in the URL, this will return a URL identical to the receiver and nil. | |
/// | |
/// Example input: https://github.com/douglashill/KeyboardKit/blob/main/Features.md#date-picker | |
/// Example output: (https://github.com/douglashill/KeyboardKit/blob/main/Features.md, date-picker) | |
func extractFragment() -> (urlWithoutFragment: URL, fragment: String?) { | |
guard var components = URLComponents(url: self, resolvingAgainstBaseURL: false) else { | |
logError("Couldn’t create URL components from URL in order to extract fragment.") |
This file contains 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 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 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") |
NewerOlder