I want to create a reusable component, probably as an open-source module. The component can contain any subviews just like any other view, but these need to be wrapped in a content-view, as I need a way to temporarily reparent the content-view out of the component and back.
Post
Replies
Boosts
Views
Activity
Implement where? Do you mean some kind of an Xcode plugin? Can you please point me to some API or documentation how to achieve that?
Connecting other view using outlet, instead of simply adding to contentView, is ugly, not straightforward, not suitable for a public module. Layout constraints are what I'm concerned with the most. When views are added directly to my custom view in Xcode/Storyboard, it's tough to recreate the constraints when moving views out and back. I even plan to offer an API where application can animate subviews as transitioning between these two states - recreating constraints makes that impossible.
Cells require subviews to be added to contentView to be able to support features like accessoryViews or swipe-for-menu. In my case it is moving the contentView out of my component and back. Without a contentView, using my component in Storyboard/XIB would be very inconvenient. Imagine the horror if that would be the case for cells. Honestly, in that case I'm not going to make that module public.
I'm hoping for Xcode to support contentView-feature for custom views, not only cells provided by SDK. It could be achieved by either simply having a contentView property, marking the component with @IBWhatever property, or by implementing a specific protocol.
Looks like time for radar.