0

Through recursion, I have accessed a private collection view inside a child view controller. It contains cells of type IceCreamCell which hold a coneImageURL string.

The problem is I'm not sure how to cast the accessed UICollectionViewCell to IceCreamCell to access the coneImageURL property since the cell class is private and Xcode doesn't recognize it.

Is there a way I can define the type by string (e.g. class(with name: "") and or request that property in that manner?

EDIT: By private I mean that it's inside a private third party framework where I don't have access to the actual files.

KingPolygon
  • 4,753
  • 7
  • 43
  • 72
  • You should be able to use value for key path. – Larme Nov 11 '19 at 18:03
  • You should look at [isKind(of:)](https://developer.apple.com/documentation/objectivec/nsobjectprotocol/1418511-iskind) and [NSClassFromString(_:)](https://developer.apple.com/documentation/foundation/1395135-nsclassfromstring). Not sure if the class string name will work, but here is an example of how I've used it. `let tabBarButtons = self.tabBar.subviews.filter({ $0.isKind(of: NSClassFromString("UITabBarButton")!) })` – DoesData Nov 11 '19 at 20:18

0 Answers0