Skip to content

Instantly share code, notes, and snippets.

@controversial
Created February 6, 2016 20:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save controversial/a43ff18e73faa2d4de19 to your computer and use it in GitHub Desktop.
Save controversial/a43ff18e73faa2d4de19 to your computer and use it in GitHub Desktop.
Foundation.py
classes=['NSAKDeserializer', 'NSAKDeserializerStream', 'NSAKSerializer', 'NSAKSerializerStream', 'NSAbstractLayoutGuide', 'NSAddressCheckingResult', 'NSAffineTransform', 'NSArchiver', 'NSArrayChange', 'NSArrayChanges', 'NSAssertionHandler', 'NSAttributedString', 'NSAutoreleasePool', 'NSAutoresizingMaskLayoutConstraint', 'NSBigMutableString', 'NSBlockExpression', 'NSBlockOperation', 'NSBlockPredicate', 'NSBoundKeyPath', 'NSBundle', 'NSBundleResourceRequest', 'NSByteCountFormatter', 'NSCachedURLResponse', 'NSCalendarDate', 'NSCharacterSet', 'NSCheapMutableString', 'NSCoder', 'NSComparisonPredicate', 'NSComparisonPredicateOperator', 'NSComplexOrthography', 'NSComplexRegularExpressionCheckingResult', 'NSCompoundPredicate', 'NSCompoundPredicateOperator', 'NSConcreteAttributedString', 'NSConcreteMutableAttributedString', 'NSConcreteValue', 'NSCondition', 'NSConditionLock', 'NSConstantString', 'NSConstantValueExpression', 'NSContentSizeLayoutConstraint', 'NSCorrectionCheckingResult', 'NSCountedSet', 'NSDashCheckingResult', 'NSDataDetector', 'NSDateCheckingResult', 'NSDateComponentsFormatter', 'NSDateFormatter', 'NSDateIntervalFormatter', 'NSDecimalNumber', 'NSDecimalNumberHandler', 'NSDirInfo', 'NSDirInfoDeserializer', 'NSDirInfoSerializer', 'NSDirectoryEnumerator', 'NSDistributedNotificationCenter', 'NSDocInfo', 'NSDocumentDeserializer', 'NSDocumentSerializer', 'NSEnergyFormatter', 'NSEqualityPredicateOperator', 'NSError', 'NSExpression', 'NSExtendedRegularExpressionCheckingResult', 'NSFalsePredicate', 'NSFileAccessArbiter', 'NSFileAccessIntent', 'NSFileCoordinator', 'NSFileHandle', 'NSFileManager', 'NSFileVersion', 'NSFileWrapper', 'NSFileWrapperMoreIVars', 'NSFilterObservationTransformer', 'NSFormatter', 'NSFunctionExpression', 'NSGZipDecoder', 'NSGrammarCheckingResult', 'NSHTTPCookie', 'NSHTTPCookieStorage', 'NSHTTPURLResponse', 'NSHashTable', 'NSHost', 'NSIBPrototypingLayoutConstraint', 'NSISEngine', 'NSISLinearExpression', 'NSISObjectiveLinearExpression', 'NSISVariable', 'NSInPredicateOperator', 'NSIndexPath', 'NSIndexSet', 'NSInvocationOperation', 'NSJSONSerialization', 'NSKeyPathExpression', 'NSKeyPathSpecifierExpression', 'NSKeyValueAccessor', 'NSKeyValueGetter', 'NSKeyValueSetter', 'NSKeyedArchiver', 'NSKeyedUnarchiver', 'NSLayoutAnchor', 'NSLayoutConstraint', 'NSLayoutDimension', 'NSLayoutXAxisAnchor', 'NSLayoutYAxisAnchor', 'NSLeafProxy', 'NSLengthFormatter', 'NSLinguisticTagger', 'NSLinkCheckingResult', 'NSLocalizableString', 'NSLock', 'NSLookupMatch', 'NSMachBootstrapServer', 'NSMachPort', 'NSMapTable', 'NSMassFormatter', 'NSMessagePort', 'NSMessagePortNameServer', 'NSMetadataItem', 'NSMetadataQuery', 'NSMetadataQueryAttributeValueTuple', 'NSMetadataQueryResultGroup', 'NSMultiReadUniWriteLock', 'NSMutableAttributedString', 'NSMutableCharacterSet', 'NSMutableIndexSet', 'NSMutableRLEArray', 'NSMutableString', 'NSMutableStringProxyForMutableAttributedString', 'NSMutableURLRequest', 'NSNetService', 'NSNetServiceBrowser', 'NSNotification', 'NSNotificationCenter', 'NSNotificationObservable', 'NSNotificationQueue', 'NSNumber', 'NSNumberFormatter', 'NSObservableKeyPath', 'NSObservation', 'NSObservationBuffer', 'NSObservationSink', 'NSObservationSource', 'NSObservationTransformer', 'NSObserverKeyPath', 'NSOldValueObservationTransformer', 'NSOperation', 'NSOperationQueue', 'NSOrderedSetChange', 'NSOrderedSetChanges', 'NSOrthography', 'NSOrthographyCheckingResult', 'NSPageData', 'NSPersonNameComponents', 'NSPersonNameComponentsFormatter', 'NSPhoneNumberCheckingResult', 'NSPinyinString', 'NSPipe', 'NSPlaceholderMutableString', 'NSPlaceholderString', 'NSPointerArray', 'NSPointerFunctions', 'NSPort', 'NSPortMessage', 'NSPortNameServer', 'NSPredicate', 'NSPredicateOperator', 'NSProcessInfo', 'NSProgress', 'NSPropertyListSerialization', 'NSProtocolChecker', 'NSProxy', 'NSPurgeableData', 'NSQuoteCheckingResult', 'NSRLEArray', 'NSRTFD', 'NSRecursiveLock', 'NSReduceObservationTransformer', 'NSRegularExpression', 'NSRegularExpressionCheckingResult', 'NSReplacementCheckingResult', 'NSScanner', 'NSSelfExpression', 'NSSetChange', 'NSSetChanges', 'NSSetExpression', 'NSSimpleAttributeDictionary', 'NSSimpleCString', 'NSSimpleOrthography', 'NSSimpleRegularExpressionCheckingResult', 'NSSortDescriptor', 'NSSpellCheckingResult', 'NSString', 'NSStringPredicateOperator', 'NSSubqueryExpression', 'NSSubstitutionCheckingResult', 'NSSubstringPredicateOperator', 'NSTask', 'NSTernaryExpression', 'NSTextCheckingResult', 'NSThread', 'NSTransitInformationCheckingResult', 'NSTruePredicate', 'NSURLAuthenticationChallenge', 'NSURLCache', 'NSURLComponents', 'NSURLConnection', 'NSURLCredential', 'NSURLCredentialStorage', 'NSURLDownload', 'NSURLError', 'NSURLFileTypeMappings', 'NSURLProtectionSpace', 'NSURLProtocol', 'NSURLQueryItem', 'NSURLRequest', 'NSURLResponse', 'NSURLSession', 'NSURLSessionConfiguration', 'NSURLSessionDataTask', 'NSURLSessionDownloadTask', 'NSURLSessionTask', 'NSURLSessionUploadTask', 'NSUUID', 'NSUbiquitousKeyValueStore', 'NSUnarchiver', 'NSUndoManager', 'NSUserActivity', 'NSValue', 'NSValueTransformer', 'NSVariableExpression', 'NSXMLParser', 'NSXPCCoder', 'NSXPCConnection', 'NSXPCInterface', 'NSXPCListener', 'NSXPCListenerEndpoint', 'NSArray', 'NSBlock', 'NSBlockInvocation', 'NSCache', 'NSCalendar', 'NSData', 'NSDate', 'NSDateComponents', 'NSDictionary', 'NSEnumerator', 'NSException', 'NSFileSecurity', 'NSInputStream', 'NSInvocation', 'NSLocale', 'NSMethodSignature', 'NSMutableArray', 'NSMutableData', 'NSMutableDictionary', 'NSMutableOrderedSet', 'NSMutableSet', 'NSNull', 'NSObject', 'NSOrderedSet', 'NSOutputStream', 'NSRunLoop', 'NSSet', 'NSSharedKeyDictionary', 'NSSharedKeySet', 'NSStream', 'NSTimeZone', 'NSTimer', 'NSURL', 'NSUserDefaults']
from objc_util import ObjCClass
for c in classes:
globals()[c]=ObjCClass(c)
classes=['NSDataAsset', 'NSFileProviderExtension', 'UIAcceleration', 'UIAccelerometer', 'UIAccessibilityCustomAction', 'UIAccessibilityElement', 'UIAccessoryBackgroundTaskAction', 'UIActionSheet', 'UIActivity', 'UIActivityContinuationAction', 'UIActivityGroupViewController', 'UIActivityIndicatorView', 'UIActivityItemProvider', 'UIActivityViewController', 'UIAddToReadingListActivity', 'UIAlertAction', 'UIAlertController', 'UIAlertView', 'UIAlphaAnimation', 'UIAnimation', 'UIAnimator', 'UIApplication', 'UIApplicationExtensionActivity', 'UIApplicationSceneClientSettings', 'UIApplicationSceneClientSettingsDiffInspector', 'UIApplicationSceneSettings', 'UIApplicationSceneSettingsDiffInspector', 'UIApplicationSceneTransitionContext', 'UIApplicationShortcutIcon', 'UIApplicationShortcutItem', 'UIAssignToContactActivity', 'UIAttachmentBehavior', 'UIAutoRotatingWindow', 'UIBarButtonItem', 'UIBarButtonItemGroup', 'UIBarItem', 'UIBezierPath', 'UIBlurEffect', 'UIBookViewController', 'UIButton', 'UICalloutBar', 'UICalloutView', 'UICheckeredPatternView', 'UIClassicController', 'UICollectionReusableView', 'UICollectionView', 'UICollectionViewCell', 'UICollectionViewController', 'UICollectionViewFlowLayout', 'UICollectionViewFlowLayoutInvalidationContext', 'UICollectionViewFocusUpdateContext', 'UICollectionViewLayout', 'UICollectionViewLayoutAttributes', 'UICollectionViewLayoutInvalidationContext', 'UICollectionViewTransitionLayout', 'UICollectionViewUpdateItem', 'UICollisionBehavior', 'UIColor', 'UICompletionTable', 'UIControl', 'UICopyToPasteboardActivity', 'UIDateLabel', 'UIDatePicker', 'UIDefaultKeyboardInput', 'UIDevice', 'UIDictationInputMode', 'UIDictationPhrase', 'UIDidTakeScreenshotAction', 'UIDocument', 'UIDocumentInteractionController', 'UIDocumentMenuViewController', 'UIDocumentPasswordField', 'UIDocumentPasswordView', 'UIDocumentPickerExtensionViewController', 'UIDocumentPickerViewController', 'UIDocumentStorageManager', 'UIDragger', 'UIDynamicAnimator', 'UIDynamicBehavior', 'UIDynamicItemBehavior', 'UIDynamicItemGroup', 'UIEvent', 'UIFetchContentInBackgroundAction', 'UIFetchContentInBackgroundActionResponse', 'UIFieldBehavior', 'UIFieldEditor', 'UIFlicker', 'UIFocusAnimationCoordinator', 'UIFocusContainerGuide', 'UIFocusGuide', 'UIFocusUpdateContext', 'UIFrameAnimation', 'UIGestureRecognizer', 'UIGradient', 'UIGravityBehavior', 'UIHandleApplicationShortcutAction', 'UIHandleBackgroundURLSessionAction', 'UIHandleLocalNotificationAction', 'UIHandleRemoteNotificationAction', 'UIHandleStatusBarTapAction', 'UIImage', 'UIImageAsset', 'UIImagePickerController', 'UIImageView', 'UIInputView', 'UIInputViewController', 'UIInteractionProgress', 'UIInterpolatingMotionEffect', 'UIKBCacheToken', 'UIKBGeometry', 'UIKBMergeAction', 'UIKBRenderFactory', 'UIKBScreenTraits', 'UIKBShape', 'UIKBSplitTraits', 'UIKBTextEditingTraits', 'UIKBTree', 'UIKBTree_Compile', 'UIKeyCommand', 'UIKeyboard', 'UIKeyboardEmojiCategory', 'UIKeyboardImpl', 'UIKeyboardInputMode', 'UIKeyboardInputModeController', 'UIKeyboardLayout', 'UIKeyboardPreferencesController', 'UIKeyboardSuggestedInputMode', 'UILabel', 'UILayoutGuide', 'UILexicon', 'UILexiconEntry', 'UILocalNotification', 'UILocalizedIndexedCollation', 'UILongPressGestureRecognizer', 'UIMailActivity', 'UIManagedDocument', 'UIMarkupTextPrintFormatter', 'UIMenuController', 'UIMenuItem', 'UIMessageActivity', 'UIModalView', 'UIMoreListController', 'UIMoreNavigationController', 'UIMotionEffect', 'UIMotionEffectGroup', 'UIMovieScrubber', 'UIMultiColumnsNavigationTransitionView', 'UIMutableApplicationSceneClientSettings', 'UIMutableApplicationSceneSettings', 'UIMutableApplicationShortcutItem', 'UIMutableUserNotificationAction', 'UIMutableUserNotificationActionSettings', 'UIMutableUserNotificationCategory', 'UINavigationBar', 'UINavigationButton', 'UINavigationController', 'UINavigationItem', 'UINavigationTransitionView', 'UINib', 'UINibKeyValuePair', 'UIOldSliderControl', 'UIOpenInIBooksActivity', 'UIOpenURLAction', 'UIPageControl', 'UIPageController', 'UIPageControllerScrollView', 'UIPageViewController', 'UIPanGestureRecognizer', 'UIPasscodeField', 'UIPasteboard', 'UIPercentDrivenInteractiveTransition', 'UIPeripheralHost', 'UIPickerContentView', 'UIPickerView', 'UIPinchGestureRecognizer', 'UIPopoverBackgroundView', 'UIPopoverController', 'UIPopoverPresentationController', 'UIPresentationController', 'UIPress', 'UIPressesEvent', 'UIPreviewAction', 'UIPreviewActionGroup', 'UIPreviewForceInteractionProgress', 'UIPreviewInteractionController', 'UIPreviewItemController', 'UIPreviewMenuItem', 'UIPreviewPresentationController', 'UIPrintActivity', 'UIPrintFormatter', 'UIPrintInfo', 'UIPrintInteractionController', 'UIPrintPageRenderer', 'UIPrintPaper', 'UIPrinter', 'UIPrinterPickerController', 'UIProgressHUD', 'UIProgressIndicator', 'UIProgressView', 'UIPushBehavior', 'UIReferenceLibraryViewController', 'UIRefreshControl', 'UIRegion', 'UIRemoteApplication', 'UIRemoveControl', 'UIResponder', 'UIRivenFactory', 'UIRotationAnimation', 'UIRotationGestureRecognizer', 'UISaveToCameraRollActivity', 'UIScreen', 'UIScreenEdgePanGestureRecognizer', 'UIScreenMode', 'UIScrollAnimation', 'UIScrollView', 'UIScrubberControl', 'UISearchBar', 'UISearchContainerViewController', 'UISearchController', 'UISearchDisplayController', 'UISearchField', 'UISearchResultsTableView', 'UISegmentedControl', 'UISimpleInteractionProgress', 'UISimpleTextPrintFormatter', 'UISiriTaskAction', 'UISlider', 'UISnapBehavior', 'UISnapshotView', 'UISocialActivity', 'UISplitViewController', 'UIStackView', 'UIStatusBar', 'UIStatusBarAnimationParameters', 'UIStatusBarCorners', 'UIStatusBarHideAnimationParameters', 'UIStatusBarOrientationAnimationParameters', 'UIStatusBarServer', 'UIStatusBarStyleAnimationParameters', 'UIStatusBarStyleRequest', 'UIStatusBarWindow', 'UIStepper', 'UIStoryboard', 'UIStoryboardPopoverSegue', 'UIStoryboardSegue', 'UIStoryboardUnwindSegueSource', 'UISwipeGestureRecognizer', 'UISwitch', 'UISystemInputViewController', 'UISystemNavigationAction', 'UISystemNavigationActionDestinationContext', 'UITabBar', 'UITabBarController', 'UITabBarItem', 'UITableView', 'UITableViewCell', 'UITableViewCellLayoutManager', 'UITableViewCellLayoutManagerValue1', 'UITableViewController', 'UITableViewDataSource', 'UITableViewFocusUpdateContext', 'UITableViewHeaderFooterView', 'UITableViewRow', 'UITableViewRowAction', 'UITableViewSection', 'UITapGestureRecognizer', 'UITextChecker', 'UITextContentView', 'UITextEffectsHostingInfo', 'UITextEffectsWindow', 'UITextField', 'UITextInputAssistantItem', 'UITextInputController', 'UITextInputMode', 'UITextInputStringTokenizer', 'UITextInputTraits', 'UITextInteractionAssistant', 'UITextLabel', 'UITextPosition', 'UITextRange', 'UITextRenderingAttributes', 'UITextSelectionRect', 'UITextTapRecognizer', 'UITextView', 'UITextViewPrintFormatter', 'UIToolbar', 'UIToolbarButton', 'UITouch', 'UITraitCollection', 'UITransformAnimation', 'UITransitionView', 'UITwoSidedAlertController', 'UIUnhandledBackButtonAction', 'UIUnhandledMenuButtonAction', 'UIUserNotificationAction', 'UIUserNotificationActionSettings', 'UIUserNotificationCategory', 'UIUserNotificationSettings', 'UIVibrancyEffect', 'UIVideoEditorController', 'UIView', 'UIViewController', 'UIViewControllerPreviewAction', 'UIViewPrintFormatter', 'UIVirtualResizeAction', 'UIVirtualResizeResetAction', 'UIVisualEffect', 'UIVisualEffectView', 'UIWKAutocorrectionContext', 'UIWKAutocorrectionRects', 'UIWKSelectionAssistant', 'UIWKTextInteractionAssistant', 'UIWatchKitExtensionRequestAction', 'UIWatchKitExtensionRequestActionResponse', 'UIWebBrowserView', 'UIWebClip', 'UIWebClipIcon', 'UIWebClipLinkTag', 'UIWebDocumentView', 'UIWebDocumentViewPrintFormatter', 'UIWebElementAction', 'UIWebElementActionInfo', 'UIWebFormAccessory', 'UIWebGeolocationPolicyDecider', 'UIWebPDFLinkAction', 'UIWebPDFSearchController', 'UIWebPDFSearchResult', 'UIWebPDFView', 'UIWebPDFViewHandler', 'UIWebRotatingAlertController', 'UIWebScrollView', 'UIWebTiledView', 'UIWebTouchEventsGestureRecognizer', 'UIWebView', 'UIWebViewPrintFormatter', 'UIWindow', 'UIWindowController', 'NSATSGlyphStorage', 'NSATSLineFragment', 'NSATSTypesetter', 'NSAttributeDictionary', 'NSAttributeDictionaryEnumerator', 'NSCIDGlyphInfo', 'NSCTGlyphInfo', 'NSConcreteNotifyingMutableAttributedString', 'NSConcreteTextStorage', 'NSExtraLMData', 'NSFont', 'NSGlyphGenerator', 'NSGlyphInfo', 'NSGlyphNameGlyphInfo', 'NSHTMLReader', 'NSHTMLWebDelegate', 'NSHTMLWriter', 'NSIdRunStorage', 'NSIdentityGlyphInfo', 'NSInsertionPointHelper', 'NSLayoutManager', 'NSLayoutManagerTextBlockHelper', 'NSLayoutManagerTextBlockRowArrayCache', 'NSLineFragmentRenderingContext', 'NSMutableParagraphStyle', 'NSParagraphArbitrator', 'NSParagraphStyle', 'NSParagraphStyleExtraData', 'NSRTFReader', 'NSRTFReaderTableState', 'NSRTFWriter', 'NSRunStorage', 'NSShadow', 'NSSingleLineTypesetter', 'NSStorage', 'NSStringDrawingContext', 'NSStringDrawingTextStorage', 'NSStringDrawingTextStorageSettings', 'NSSubstituteWebResource', 'NSTempAttributeDictionary', 'NSTextAlternatives', 'NSTextAttachment', 'NSTextBlock', 'NSTextBlockLayoutHelper', 'NSTextContainer', 'NSTextList', 'NSTextStorage', 'NSTextTab', 'NSTextTable', 'NSTextTableBlock', 'NSTypesetter', 'UICTFont', 'UICTFontDescriptor', 'UIFont', 'UIFontDescriptor']
from objc_util import ObjCClass
for c in classes:
globals()[c]=ObjCClass(c)
@jsbain
Copy link

jsbain commented Feb 11, 2016

For even fewer characters, and a version that works on all current, past and future iOS versions:

# coding: utf-8
from objc_util import *

c= ObjCClass.get_names(prefix=None)
for cls in c:
   if not cls.startswith('_'):
      try:
         globals()[cls]=ObjCClass(cls)
      except ValueError:
         pass

though loading every class seems very wasteful memorywise.. i only reccomend this for hacking around with code so autocomplete is easier. But better to be explicit for for distributed code, plus jedi does not seem to complete based on globals anymore in the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment