Skip to content

Instantly share code, notes, and snippets.

View oleghnidets's full-sized avatar
📱

Oleg oleghnidets

📱
View GitHub Profile
@nalexn
nalexn / CancelBag.swift
Last active November 1, 2023 06:43
Collecting AnyCancellable tokens in declarative SwiftUI fashion
// Copyright © 2019 Alexey Naumov. MIT License
import Combine
typealias CancelBag = Set<AnyCancellable>
extension CancelBag {
mutating func collect(@Builder _ cancellables: () -> [AnyCancellable]) {
formUnion(cancellables())
}
@steipete
steipete / gist:8c683dd840596e34dcb9159373cea933
Created November 8, 2017 23:33
NSObject is overloaded. This is iOS 11.2b2. Crazy. And yes, `pspdf` is guilty as well. It's so easy/convenient to make a category on it.
Class Methods:
+ (Class) safeCategoryBaseClass; (0x12c470134)
+ (BOOL) _old_unswizzled_automaticallyNotifiesObserversForKey:(id)arg1; (0x1150df5a0)
+ (id) _old_unswizzled_keyPathsForValuesAffectingValueForKey:(id)arg1; (0x1150df620)
+ (id) requiredStoreLibraryPersonalizationProperties; (0x118daaeff)
+ (void) mf_clearLocks; (0x11a41d09e)
+ (void) _accessibilityCalDetailStringForEvent:(id)arg1 inLine1:(id*)arg2 inLine2:(id*)arg3 inLine3:(id*)arg4 inLine4:(id*)arg5; (0x127db7c6e)
+ (void) _accessibilityCalGetHourDesignatorsForAM:(id*)arg1 andPM:(id*)arg2; (0x127d1e7bb)
+ (BOOL) _accessibilityCalSpaceBetweenDesignatorsAndHour; (0x127d1e7cb)
+ (BOOL) _accessibilityCalHourDesignatorsAreBeforeHour; (0x127d1e7ec)
@JadenGeller
JadenGeller / Cluster.swift
Created March 13, 2017 01:27
Class Cluster
class Number /* class cluser */ {
class Int8: Number {
var value: Swift.Int8
init(_ value: Swift.Int8) { self.value = value }
}
class Int: Number {
var value: Swift.Int
init(_ value: Swift.Int) { self.value = value }
}
public extension Int {
public var seconds: DispatchTimeInterval {
return DispatchTimeInterval.seconds(self)
}
public var second: DispatchTimeInterval {
return seconds
}
@paulofierro
paulofierro / wkwebview_disable_magnification.m
Last active March 13, 2020 16:11
Disable magnification in WKWebView
// Remember to @import WebKit at the top of the class
// Javascript that disables pinch-to-zoom by inserting the HTML viewport meta tag into <head>
NSString *source = @"var meta = document.createElement('meta'); \
meta.name = 'viewport'; \
meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'; \
var head = document.getElementsByTagName('head')[0];\
head.appendChild(meta);";
WKUserScript *script = [[WKUserScript alloc] initWithSource:source injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@gregfu
gregfu / gist:1524894
Created December 27, 2011 19:35 — forked from shazron/gist:943736
About XCode 4 Project Template (How To Create Custom Project Template)
From: http://snipt.net/yonishin/about-xcode-4-project-template
XCode 4 Projects and Files Template Folder: /Developer/Library/Xcode/Templates
Examples:
/Developer/Library/Xcode/Templates/Project Templates/Base/Other/Empty.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Base/Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Mac Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Command Line Tool.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Cocoa Application.xctemplate