I need to get the frame of the imageView inside the tabBar and also the frame of the navigationBarButtonItem using:
let fifthTab = tabBarController?.tabBar.items?[4].value(forKey: "view") as? UIView { ... }
let barButtonItemView = self.navigationItem.rightBarButtonItem?.value(forKey: "view") as? UIView { ... }
In both situations I'm successfully setting some other UIViews based on their frame. I read that they are private APIs and using private APIs will result in an AppStore rejection but i found plenty of examples using them between SO and GitHub. No one has confirmed wether these will or won't result in a rejection when going live to the AppStore.
Can someone confirm that using these APIs will result in a rejection or not?
It depends on Apple. But basically will not be rejected. Apple has a special private API scanner to detect whether you use sensitive APIs. While valueForKey and view are fairly common and legal APIs, it is difficult for scanners to scan them out.