Testing UIRefreshControl on iOS16 and iOS 17
- Works fine on iOS 16
- A UIRefreshControl received offscreen beginRefreshing. Ignored. Break on UIRefreshControlReceivedOffscreenBeginRefreshing to debug. <UIRefreshControl: 0x1042081c0; frame = (0 0; 0 60); hidden = YES; autoresize = W; layer = <CALayer: 0x60000022f580>>
- UIRefreshControl ignores calls to begin refreshing if it's not on screen
- viewDidLoad(), viewWillAppear(); these methods anwsers to life cycles that are not on screen yet
- viewDidAppear(_) method is called when views are on Screen already, so this will fixed the "UIRefreshControlReceivedOffscreenBeginRefreshing error"
- but the UIRefreshControl will not still start to refrest on iOS 17
- the refreshing actually works with Solution 1's viewDidAppear(_), because if a gentle pull down is applied on the screen the refresh control is revealed.
- Summarily, it appears that viewDidAppear(_) is too late to handle this with respect to view life cycles
- Also viewDidLoad(), viewWillAppear() are to early.
- In iOS 17, Apple introduced a new life cycle in iOS 17, viewIsAppearing(_)
- having the refresh method in the life cycle hierarchy fixes the issue
- viewIsAppearing(_) is backwards compartible all the way down to iOS 13.
- to use this method, you need to be running on XCode 15 and above