Post

Replies

Boosts

Views

Activity

Reply to Why doesn’t getAPI() show up in autocomplete despite having a default implementation in a protocol extension?
@DTS Engineer Thank you for answering my question 😆 I expect it to autocomplete as getAPI() when I press the return key in the state shown in the screenshot you provided. However, it always autocompletes as getAPI(from: <#String?#>). The same behavior occurs even in a new project. If I modify the existing code to the following and execute it, the autocomplete should behave the same. However, I’m not sure what difference is causing it not to work: import Foundation public protocol Repository { func getAPI(from url: String?) } extension Repository { public func getAPI(from url: String?) { getAPI(from: url) } } final class _Repository: Repository { func getAPI(from url: String? = "https://...") { // Task... } } let repo = _Repository() repo.getAPI( // Autocomplete suggest getAPI() first.
Jan ’25