Slide 1

Slide 1 text

Code Snippets For Debugging

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Getting all the notifications: let center = NotificationCenter.default center.addObserver(forName: nil, object: nil, queue: nil) { notification in print(notification.name) }

Slide 5

Slide 5 text

… Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIKeyboardWillChangeFrameNotification) Name(rawValue: UIKeyboardPrivateWillChangeFrameNotification) Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIKeyboardWillShowNotification) Name(rawValue: UIKeyboardPrivateWillShowNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UITextViewTextDidBeginEditingNotification) Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UIViewAnimationDidStopNotification) … Name(rawValue: UIViewAnimationDidStopNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UIViewAnimationDidStopNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UIViewAnimationDidStopNotification) Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIKeyboardDidChangeFrameNotification) Name(rawValue: UIKeyboardPrivateDidChangeFrameNotification) Name(rawValue: UIKeyboardDidShowNotification)

Slide 6

Slide 6 text

… Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIKeyboardWillChangeFrameNotification) Name(rawValue: UIKeyboardPrivateWillChangeFrameNotification) Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIKeyboardWillShowNotification) Name(rawValue: UIKeyboardPrivateWillShowNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UITextViewTextDidBeginEditingNotification) Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UIViewAnimationDidStopNotification) … Name(rawValue: UIViewAnimationDidStopNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UIViewAnimationDidStopNotification) Name(rawValue: UIViewAnimationDidCommitNotification) Name(rawValue: UIViewAnimationDidStopNotification) Name(rawValue: UITextEffectsWindowDidRotateNotification) Name(rawValue: UIKeyboardDidChangeFrameNotification) Name(rawValue: UIKeyboardPrivateDidChangeFrameNotification) Name(rawValue: UIKeyboardDidShowNotification)

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Getting all the properties: var count: CUnsignedInt = 0 let ivarList = class_copyIvarList(UICollectionView.self, &count) for i in (0..

Slide 9

Slide 9 text

Property:_layout, Type:@"UICollectionViewLayout" Property:_dataSource, Type:@"" Property:_backgroundView, Type:@"UIView" Property:_indexPathsForSelectedItems, Type:@"NSMutableSet" Property:_cellReuseQueues, Type:@"NSMutableDictionary" Property:_supplementaryViewReuseQueues, Type:@"NSMutableDictionary" Property:_indexPathsForHighlightedItems, Type:@"NSMutableSet" Property:_reloadingSuspendedCount, Type:q … Property:_focusedViewType, Type:q Property:_contentFocusContainerGuide, Type:@"UIFocusContainerGuide" Property:_collectionViewFlags, Type:{? ="delegateShouldHighlightItemAtIndexPath"b1"delegateDidHighlightItemAtIndexPath"b1"delegateDidUnhighlightItemAtIndexPath"b1"delegateShouldSelectItemAtInde xPath"b1"delegateShouldDeselectItemAtIndexPath"b1"delegateDidSelectItemAtIndexPath"b1"delegateDidDeselectItemAtIndexPath"b1"delegateSupportsMenus"b1"del egateWillDisplayCell"b1"delegateWillDisplaySupplementaryView"b1"delegateDidEndDisplayingCell"b1"delegateDidEndDisplayingSupplementaryView"b1"delegateIndex ForReferenceItemDuringLayoutTransition"b1"delegateOverrideForTransitionOffsetSize"b1"delegateTargetContentOffsetForProposedContentOffsetSPI"b1"delegateTarg etContentOffsetForProposedContentOffset"b1"delegateTargetIndexPathForMoveSPI"b1"delegateTargetIndexPathForMove"b1"delegateCanFocusItemAtIndexPath depr ecated"b1"delegateDidFocusItemAtIndexPath deprecated"b1"delegateCanFocusItemAtIndexPath"b1"delegateDidFocusItemAtIndexPath"b1"delegateDidUnfocusItemAtI ndexPath"b1"delegateShouldChangeFocusedItem"b1"delegateIndexPathForPreferredFocusedItem"b1"delegateShouldUpdateFocusFromRowAtIndexPathToView"b1”…} Property:_lastLayoutOffset, Type:{CGPoint="x"d"y"d} Property:_prefetchMode, Type:q Property:_currentPrefetchingContext, Type:@" UICollectionViewPrefetchingContext" Property: prefetchCacheItems, Type:@"NSMutableDictionary" Property: prefetchVelocityIntegrator, Type:@" UIVelocityIntegrator" Property:_prefetchDataSource, Type:@"" Property:_containerScrollViewVisitationCount, Type:q Property:_prefetchingEnabled, Type:B Property:_focusedCellIndexPath, Type:@"NSIndexPath” Property:_focusedCell, Type:@"UICollectionReusableView" …

Slide 10

Slide 10 text

LLDB fun!

Slide 11

Slide 11 text

(lldb) e -l swift -- import (lldb) e -l swift -- print()

Slide 12

Slide 12 text

(lldb) e -l swift -- import (lldb) e -l swift -- print() (lldb) settings set target.language swift

Slide 13

Slide 13 text

(lldb) e -l swift -- import (lldb) e -l swift -- print() (lldb) settings set target.language swift caro$ touch ~/.lldbinit caro$ chmod +x ~/.lldbinit

Slide 14

Slide 14 text

Facebook Chisel!

Slide 15

Slide 15 text

Some useful commands: • pviews - Print the recursive view description for the key window

Slide 16

Slide 16 text

Some useful commands: • pviews - Print the recursive view description for the key window • pactions - Print the actions and targets of a control

Slide 17

Slide 17 text

Some useful commands: • pviews - Print the recursive view description for the key window • pactions - Print the actions and targets of a control • paltrace - Print the Auto Layout trace for the given view

Slide 18

Slide 18 text

Resources: • CFHipsterRef: Low-Level Programming on iOS & Mac OS X by Mattt Thompson • Swift funtime ! by Boris Bügling • Facebook Chisel : https://github.com/facebook/chisel

Slide 19

Slide 19 text

Thanks!