I have some usecases where I need to add some Dele...
# compose-ios
m
I have some usecases where I need to add some Delegate protocols to the ComposeUIViewController, So I'm rewriting the UiViewController class to match my needs. I think that we could have an abstract ComposeUIViewController class that contains an implementation for the methods needed and we can customize it and add delegations. It makes it easier to have more control
I was trying to make my own abstract UIViewController and I get this error:
Non-final Kotlin subclasses of Objective-C classes are not yet supported
Which is a limitation from Kotlin/Native so K/N needs to support Non-final Kotlin subclasses of Objective-C classes before we can have and abstract
ComposeUIViewController
class
d
Yes, thanks for this information. What kind of behavior do you want to achieve? Maybe we can provide some builder functions to add more customizations.
m
I'm creating a UIViewController for a BottomSheet and I want to implement this
UIAdaptivePresentationControllerDelegateProtocol
to get notified when the sheet is dismissed.
a
May be
Copy code
LocalUIViewController.current.presentationController?.setDelegate()
suits your needs?
m
I'm not inside a Composable Scope BTW and I have direct access to the viewController, Also I tried
presentationController?.setDelegate()
before but it doesn't work even setting
transitioningDelegate
doesn't work. I saw similar questions from iOS developers and the problem is that these methods are called too late, they needs to be called from the constructor of the UIViewController.
I tried to wrap the
ComposeUIViewController
inside an empty
UIViewController
and it works fine, I can implement the delegate or pass it using
presentationController?.setDelegate()