Skip to content

Instantly share code, notes, and snippets.

@BenjyWiener
BenjyWiener / Swizzle.py
Created July 21, 2016 21:21
Pythonista module for swizzling methods using the Objective-C runtime.
from objc_util import *
from inspect import getargspec
c.method_setImplementation.restype = c_void_p
c.method_setImplementation.argtypes = [c_void_p, c_void_p]
c.method_getImplementation.restype = c_void_p
c.method_getImplementation.argtypes = [c_void_p]
''' Make `swizzledFunc` run instead of `method` '''
@BenjyWiener
BenjyWiener / Add Screen Recorder Button.py
Last active September 15, 2017 08:06
Screen recorder for Pythonista
# coding: utf-8
from objc_util import *
from ReplayKit import *
from console import alert
import ui
UIBarButtonItem = ObjCClass('UIBarButtonItem')
def main():
@BenjyWiener
BenjyWiener / local_authentication.py
Created January 29, 2016 17:53
LocalAuthentication for Pyhtonista
# coding: utf-8
from objc_util import *
import time
def authenticate(reason = ' '):
ObjCClass('NSBundle').bundleWithPath_('/System/Library/Frameworks/LocalAuthentication.framework').load()
context = ObjCClass('LAContext').alloc().init()
global result
result = None