Skip to content

Commit

Permalink
Fix binding type lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle committed Jan 6, 2025
1 parent 2d693f2 commit 8a44808
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,19 @@ public class DefaultInspectableTypeBindingResolver: InspectableTypeBindingResolv

private func lookup(typeName: String) -> (any InspectableTypeBinding.Type)? {
guard let lastDotIndex = typeName.lastIndex(of: ".") else { return nil }
guard var bindingClassName = toModuleName(namespace: typeName[..<lastDotIndex]) else { return nil }
guard let moduleName = toModuleName(namespace: typeName[..<lastDotIndex]) else { return nil }

// ModuleName.NamespaceSubnamespace_TypeNameBinding
var bindingClassName = moduleName
bindingClassName += "."
for typeNameChar in typeName[..<lastDotIndex] {
guard typeNameChar != "." else { continue }
bindingClassName.append(typeNameChar)
}
bindingClassName += "_"
bindingClassName += typeName[typeName.index(after: lastDotIndex)...]
bindingClassName += "Binding"

return NSClassFromString(bindingClassName) as? any InspectableTypeBinding.Type
}

Expand Down

0 comments on commit 8a44808

Please sign in to comment.