Closed tjprescott closed 1 year ago
cc/ @jimchou-dev
Error for duplicate definition id
Repo: https://github.com/Azure/communication-ui-library-ios (reproduced in commit 6afcfcfac25acdc1776f7dee877e152f9373422f)
Scenario
2 subclass both implementing from DrawerContainerViewController
with different type, each have an extension on UITableViewDataSource, UITableViewDelegate
Original
class SomeClass {
}
extension SomeClass {
func doSomething() -> String {
return "Something"
}
}
Option 1
We would simply collect the extensions within SomeClass
and render them as such, even if the syntax isn't technically valid.
class SomeClass {
extension SomeClass {
func doSomething() -> String
}
}
Option 2 Collect the methods/properties defined in the extension and display them as though they were properties of the original class definition. This does lose the context that the method actual came from an extension.
class SomeClass {
func doSomething() -> String
}
After discussion, the way forward will be to render extensions as follows:
Currently, extension blocks from the source code appear in the APIView. The "extension Foo" line is not commentable, and how to represent this is tricky. There's not a good way to create a deterministic ID for the block itself.
For example:
Clicking "MyClass" will take you to the class definition, but there's no way to link to the extension block.
One idea would be to essentially "collect" all of the extensions and stuff them in as though they were in the class block. That could be difficult and not work for all cases.