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 PinEntryView: View { | |
var pinLimit: Int = 4 | |
var isError: Bool = false | |
var canEdit: Bool = true | |
@Binding var pinCode: String | |
private var pins: [String] { |
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
// http://defagos.github.io/yet_another_article_about_method_swizzling/ (Thank you!!) | |
// Returns the original implementation | |
static _Nullable IMP pspdf_swizzleSelector(Class clazz, SEL selector, IMP newImplementation) { | |
NSCParameterAssert(clazz); | |
NSCParameterAssert(selector); | |
NSCParameterAssert(newImplementation); | |
// If the method does not exist for this class, do nothing. | |
const Method method = class_getInstanceMethod(clazz, selector); | |
if (!method) { |
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 | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
let window = UIWindow(frame: UIScreen.main.bounds) |
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 | |
/// A validation rule for text input. | |
public enum TextValidationRule { | |
/// Any input is valid, including an empty string. | |
case noRestriction | |
/// The input must not be empty. | |
case nonEmpty | |
/// The enitre input must match a regular expression. A matching substring is not enough. | |
case regularExpression(NSRegularExpression) |
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
""" File: nudge.py | |
An lldb Python script to add a nudge command. | |
Add to ~/.lldbinit: | |
command script import ~/path/to/nudge.py | |
Usage: | |
(lldb) nudge x-offset y-offset [view] |
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
# full diff | |
git diff <SHA1> <SHA1> -- `find . -name '<pattern>'` | |
# only file names | |
git diff <SHA1> <SHA1> --name-status -- `find . -name '<pattern>'` |
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
// | |
// PSPDFGenerics.h | |
// PSPDFFoundation | |
// | |
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com. | |
// Try it today using our free PDF Viewer app: https://pdfviewer.io/ | |
// | |
// This file is MIT licensed. | |
/** |
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
public struct TextSize { | |
fileprivate struct CacheEntry: Hashable { | |
let text: String | |
let font: UIFont | |
let width: CGFloat | |
let insets: UIEdgeInsets | |
fileprivate var hashValue: Int { | |
return text.hashValue ^ Int(width) ^ Int(insets.top) ^ Int(insets.left) ^ Int(insets.bottom) ^ Int(insets.right) |
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
// clang -cc1 -analyzer-checker-help | |
// OVERVIEW: Clang Static Analyzer Checkers List | |
// USAGE: -analyzer-checker <CHECKER or PACKAGE,...> | |
// | |
// CHECKERS: | |
// alpha.core.BoolAssignment Warn about assigning non-{0,1} values to Boolean variables | |
// alpha.core.CallAndMessageUnInitRefArg | |
// Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers, and pointer to undefined variables) | |
// alpha.core.CastSize Check when casting a malloc'ed type T, whether the size is a multiple of the size of T | |
// alpha.core.CastToStruct Check for cast from non-struct pointer to struct pointer |
NewerOlder