iOS Xcode Swift Autocomplete Broken

Xcode 9 Autocomplete Not Working 100% - Partially Working

Deleting the DERIVED DATA folder seemed to fix my issue. Thanks to this post: swift println() not showing autocomplete options while writting code

Xcode 8 Autocomplete Broken - Displays only limited User code snippets - Know why?

Caches are the Achilles heel of macOS so... on a lark, dug around and found the ~/Library/Caches/com.apple.dt.Xcode file. It was 1.33G (jez).

I quit Xcode, deleted the cache "file", then relaunched Xcode. Voilà!, здесь!, (or down south "Hot DANG!") we are back in business. Code coloring is back, autocompletion is back, auto compile (auto complain :-) is now working.

Xcode Autocomplete Not Working in SwiftUI

I think it was the bug with the current version of Xcode. Using the beta version of Xcode fixed the problem.

iOS Xcode Swift autocomplete broken?

From "Calling Methods Through Optional Chaining":

Any attempt to set a property through optional chaining returns a
value of type Void?, which enables you to compare against nil to see
if the property was set successfully ...

Therefore the type of the expression

self.customView?.transform = CGAffineTransformMakeTranslation(0.0, 0.0)

is Void? (optional Void). And if a closure consists only of a single expression,
then this expression is automatically taken as the return value.
The error message is quite misleading, but it comes from the fact that Void? is
different from Void.

Adding an explicit return statement solves the problem:

UIView.animateWithDuration(0.5, animations: { () -> Void in
self.customView?.transform = CGAffineTransformMakeTranslation(0.0, 0.0)
return
})

Update: Adding an explicit return statement it not necessary
anymore with Swift 1.2 (Xcode 6.3). From the beta release notes:

Unannotated single-expression closures with non-Void return types can now be used in Void contexts.

Xcode 10 autocomplete not working in other swift file

It seems like there is some issue with the auto-suggestion in Xcode-10. I just tried with the below example and found that suggestion were not appearing for default initialisation. However if you write and compile, it will work.

let newObj = MyStruct(aa: "1", bb: "2")

Even if you want to debug it more, use init method, it will show auto-suggestion as well:

let newObj1 = MyStruct.init(aa: "A", bb: "B")

MyStruct.swift

import Foundation

struct MyStruct {
var aa = ""
var bb = ""
}

func test() {
let myStruct = MyStruct(aa: "", bb: "")
print(myStruct)
}

ViewController.swift

import UIKit

override func viewDidLoad() {
super.viewDidLoad()
let newObj = MyStruct(aa: "1", bb: "2")
print(newObj)

let newObj1 = MyStruct.init(aa: "A", bb: "B")
print(newObj1)
}

Objective C block syntax - Xcode autocomplete is not working

I found it! the parameter names have to go after Nullable, like so:

[SwiftClass passValue: response completion:^(NSDictionary<NSString *,NSString *> * _Nullable responseDictionary, ErrorResponse * _Nullable errorResponse) {}];

Xcode autocomplete stopped working

Xcode 6.3 public release version (released publicly at time of writing) seems to have fixed these issues (at long last).

Xcode 6.1 swift autocomplete and code sense broken

I have had the same issue for many days while working in swift, finally I have deleted some old data in the directory ~/Library/Developer/Xcode/DerivedData and started the xcode again and error is disappeared.

Hope it helps!



Related Topics



Leave a reply



Submit