@ -155,20 +155,32 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
 
			
		
	
		
		
			
				
					
					            return 
            return 
 
			
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        //   W e   c o u l d   t r y   t o   b e   m o r e   p r e c i s e   b y   d o i n g   s o m e t h i n g   l i k e 
        let  verticalOffset :  CGFloat 
 
			
				
				
			
		
	
		
		
			
				
					
					        // 
        if  #available ( iOS  11 ,  * )  { 
 
			
				
				
			
		
	
		
		
			
				
					
					        //             l e t   b o t o m O f f s e t   =   c o l l e c t i o n V i e w . c o n t e n t S i z e   +   c o l l e c t i o n V i e w . c o n t e n t I n s e t . t o p   -   c o l l e c t i o n V i e w . b o u n d s . h e i g h t 
            //   O n   i O S 1 0   a n d   e a r l i e r ,   w e   c a n   b e   p r e c i s e ,   b u t   a s   o f   i O S 1 1   ` c o l l e c t i o n V i e w . c o n t e n t I n s e t ` 
 
			
				
				
			
		
	
		
		
			
				
					
					        // 
            //   i s   b a s e d   o n   ` s a f e A r e a I n s e t s ` ,   w h i c h   i s n ' t   a c c u r a t e   u n t i l   ` v i e w D i d A p p e a r `   a t   t h e   e a r l i e s t . 
 
			
				
				
			
		
	
		
		
			
				
					
					        //   B u t   ` c o l l e c t i o n V i e w . c o n t e n t I n s e t `   i s   b a s e d   o n   ` s a f e A r e a I n s e t s ` ,   w h i c h   i s n ' t   a c c u r a t e 
            // 
 
			
				
				
			
		
	
		
		
			
				
					
					        //   u n t i l   ` v i e w D i d A p p e a r `   a t   t h e   e a r l i e s t . 
            //   f r o m   h t t p s : / / d e v e l o p e r . a p p l e . c o m / d o c u m e n t a t i o n / u i k i t / u i v i e w / p o s i t i o n i n g _ c o n t e n t _ r e l a t i v e _ t o _ t h e _ s a f e _ a r e a 
 
			
				
				
			
		
	
		
		
			
				
					
					        // 
            //   >   M a k e   y o u r   m o d i f i c a t i o n s   i n   [ v i e w D i d A p p e a r ]   b e c a u s e   t h e   s a f e   a r e a   i n s e t s   f o r   a   v i e w   a r e 
 
			
				
				
			
		
	
		
		
			
				
					
					        //   f r o m   h t t p s : / / d e v e l o p e r . a p p l e . c o m / d o c u m e n t a t i o n / u i k i t / u i v i e w / p o s i t i o n i n g _ c o n t e n t _ r e l a t i v e _ t o _ t h e _ s a f e _ a r e a 
            //   >   n o t   a c c u r a t e   u n t i l   t h e   v i e w   i s   a d d e d   t o   a   v i e w   h i e r a r c h y . 
 
			
				
				
			
		
	
		
		
			
				
					
					        //   >   M a k e   y o u r   m o d i f i c a t i o n s   i n   [ v i e w D i d A p p e a r ]   b e c a u s e   t h e   s a f e   a r e a   i n s e t s   f o r   a   v i e w   a r e 
            // 
 
			
				
				
			
		
	
		
		
			
				
					
					        //   >   n o t   a c c u r a t e   u n t i l   t h e   v i e w   i s   a d d e d   t o   a   v i e w   h i e r a r c h y . 
            //   O v e r s h o o t i n g   l i k e   t h i s   w o r k s   w i t h o u t   v i s i b l e   a n i m a t i o n   g l i t c h .   o n   i O S 1 1 + 
 
			
				
				
			
		
	
		
		
			
				
					
					        // 
            //   H o w e v e r ,   b e f o r e   i O S 1 1 ,   " o v e r s h o o t i n g "   t h e   c o n t e n t O f f s e t   l i k e   t h i s   p r o d u c e s   a   b r o k e n 
 
			
				
				
			
		
	
		
		
			
				
					
					        //   O v e r s h o o t i n g   l i k e   t h i s   w o r k s   w i t h o u t   v i s i b l e   a n i m a t i o n   g l i t c h . 
            //   l a y o u t   o r   h a n g i n g .   L u c k i l y   f o r   t h o s e   v e r s i o n s ,   b e f o r e   t h e   s a f e A r e a I n s e t   f e a t u r e 
 
			
				
				
			
		
	
		
		
			
				
					
					        let  bottomOffset  =  CGFloat . greatestFiniteMagnitude 
            //   e x i s t e d ,   w e   c a n   a c c u r a t e l y   a c c e s s e   c o l l e t i o n V i e w . c o n t e n t I n s e t   b e f o r e   ` v i e w D i d A p p e a r ` 
 
			
				
				
			
		
	
		
		
			
				
					
					        collectionView . setContentOffset ( CGPoint ( x :  0 ,  y :  bottomOffset ) ,  animated :  animated ) 
            //   a n d   c a l c u l a t e   a   p r e c i s e   c o n t e n t   o f f s e t . 
 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					            verticalOffset  =  CGFloat . greatestFiniteMagnitude 
 
			
		
	
		
		
			
				
					
					        }  else  { 
 
			
		
	
		
		
			
				
					
					            let  visibleHeight  =  collectionView . bounds . height  -  collectionView . contentInset . top 
 
			
		
	
		
		
			
				
					
					            let  contentHeight  =  collectionView . contentSize . height 
 
			
		
	
		
		
			
				
					
					            if  contentHeight  <=  visibleHeight  { 
 
			
		
	
		
		
			
				
					
					                verticalOffset  =  - collectionView . contentInset . top 
 
			
		
	
		
		
			
				
					
					            }  else  { 
 
			
		
	
		
		
			
				
					
					                let  topOfLastPage  =  contentHeight  -  collectionView . bounds . height 
 
			
		
	
		
		
			
				
					
					                verticalOffset  =  topOfLastPage 
 
			
		
	
		
		
			
				
					
					            } 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					        collectionView . setContentOffset ( CGPoint ( x :  0 ,  y :  verticalOffset ) ,  animated :  animated ) 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    private  func  reloadDataAndRestoreSelection ( )  { 
    private  func  reloadDataAndRestoreSelection ( )  {