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
// | |
// NSApplication+openSettings.swift | |
// | |
// Created by Stephan Casas on 12/3/23. | |
// | |
import SwiftUI; | |
extension NSApplication { | |
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 StringProtocol { | |
subscript(_ offset: Int) -> String.Element { | |
if offset >= 0 { | |
self[index(startIndex, offsetBy: offset)] | |
} else { | |
self[index(endIndex, offsetBy: offset)] | |
} | |
} | |
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 SwiftUI | |
struct TaskTrigger<T: Equatable>: Equatable { | |
fileprivate enum TaskState<S: Equatable>: Equatable { | |
case inactive | |
case active(value: S, uniqueId: UUID? = nil) | |
} | |
fileprivate var state: TaskState<T> = .inactive |
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
// Taken from Apple's App Dev Training: https://developer.apple.com/tutorials/app-dev-training/ | |
/// This color is either black or white, whichever is more accessible when viewed against the scrum color. | |
var accessibleFontColor: Color { | |
var red: CGFloat = 0 | |
var green: CGFloat = 0 | |
var blue: CGFloat = 0 | |
UIColor(self).getRed(&red, green: &green, blue: &blue, alpha: nil) | |
return isLightColor(red: red, green: green, blue: blue) ? .black : .white | |
} |
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 Locale { | |
static func is12HoursFormat() -> Bool { | |
DateFormatter.dateFormat(fromTemplate: "j", options: 0, locale: Locale.current)?.range(of: "a") != nil | |
} | |
static func is24HoursFormat() -> Bool { | |
!Self.is12HoursFormat() | |
} | |
func is12HoursFormat() -> Bool { |
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
// | |
// HWKViewController.m | |
// HardwareKeyboardUI | |
// | |
// Created by Steven Troughton-Smith on 13/11/2013. | |
// Copyright (c) 2013 High Caffeine Content. All rights reserved. | |
// | |
#import "HWKViewController.h" |
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
// direct check for external keyboard | |
+ (BOOL)_isExternalKeyboardAttached | |
{ | |
BOOL externalKeyboardAttached = NO; | |
@try { | |
NSString *keyboardClassName = [@[@"UI", @"Key", @"boa", @"rd", @"Im", @"pl"] componentsJoinedByString:@""]; | |
Class c = NSClassFromString(keyboardClassName); | |
SEL sharedInstanceSEL = NSSelectorFromString(@"sharedInstance"); | |
if (c == Nil || ![c respondsToSelector:sharedInstanceSEL]) { |
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/UIKit.h> | |
@interface UIWebView (Additions) | |
/*! | |
@abstract Enable/Disable the receiver from scrolling. | |
*/ | |
@property (nonatomic, assign) BOOL webViewScrollEnabled; |
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 UITextView { | |
func hideSuggestions() { | |
// Removes suggestions only | |
autocorrectionType = .no | |
//Removes Undo, Redo, Copy & Paste options | |
removeUndoRedoOptions() | |
} | |
} | |
extension UITextField { |
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
#!/bin/sh | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
# make sure the output directory exists | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Step 1. Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build |
NewerOlder