Rxswift: No autocomplete in XCode 8

Created on 11 Apr 2017  Â·  3Comments  Â·  Source: ReactiveX/RxSwift

:warning: If you don't have something to report in the following format, it will probably be easier and faster to ask in the slack channel first. :warning:

:warning: Please take you time to fill in the fields below. If we aren't provided with this basic information about your issue we probably won't be able to help you and there won't be much we can do except to close the issue :( :warning:

If you still want to report issue, please delete above statements before submitting an issue.

I have a simple Swift project with RxCocoa and RxSwift on the cocoapods. When one of the files has

import RxSwift

I get "No such module" error. If I run the app on the simulator it goes away but there is no autocomplete like this and it makes it really hard to start working with RxSwift.

Expected outcome:

Helpful autocomplete

What actually happens:

There is no autocomplete

Self contained code example that reproduces the issue:

  import RxSwift

**RxSwift/RxCocoa/RxBlocking/RxTest version/commit**

_3.0_

**Platform/Environment**

  - [ x] iOS
  - [ ] macOS
  - [ ] tvOS
  - [ ] watchOS
  - [ ] playgrounds

**How easy is to reproduce? (chances of successful reproduce after running the self contained code)**

  - [ x] easy, 100% repro
  - [ ] sometimes, 10%-100%
  - [ ] hard, 2% - 10%
  - [ ] extremely hard, %0 - 2%

**Xcode version**:

Version 8.2.1
```

:warning: Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. :warning:

Installation method:

  • [ x] CocoaPods
  • [ ] Carthage
  • [ ] Git submodules

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • [x ] yes (which ones: 7.3.1)
  • [ ] no

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • [ x] just starting
  • [ ] I have a small code base
  • [ ] I have a significant code base

Most helpful comment

You can do like this
import RxSwift
import RxCocoa

class LoginViewController: UIViewController {
@IBOutlet fileprivate var tfUsername: UITextField!
@IBOutlet fileprivate var tfPassword: UITextField!
@IBOutlet fileprivate var btLogin: UIButton!

var disposeBag = DisposeBag()

override func viewDidLoad() {
    super.viewDidLoad()

    let usernameControlProperty = tfUsername.rx.text
    let usernameValid = usernameControlProperty.orEmpty
        .map { (string) in string.characters.count >= 5}
        .shareReplay(1)
    // ...
 }

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

All 3 comments

I think this issue related to Xcode rather then library 😜

You can do like this
import RxSwift
import RxCocoa

class LoginViewController: UIViewController {
@IBOutlet fileprivate var tfUsername: UITextField!
@IBOutlet fileprivate var tfPassword: UITextField!
@IBOutlet fileprivate var btLogin: UIButton!

var disposeBag = DisposeBag()

override func viewDidLoad() {
    super.viewDidLoad()

    let usernameControlProperty = tfUsername.rx.text
    let usernameValid = usernameControlProperty.orEmpty
        .map { (string) in string.characters.count >= 5}
        .shareReplay(1)
    // ...
 }

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

I'm not sure what to do with this.

All of our unit tests are passing.

I can understand how malfunctioning autocomplete can be frustrating, but this is not an issue with this project. If it compiles, it's valid Swift code.

As far as I can tell, it does work for fresh projects, so there is maybe something in your configuration that is wrong.

I would suggest trying to create more public pressure on Apple to fix their toolchain, although even that tactic will probably fail.

¯\_(ツ)_/¯ , sorry

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marlowcharite picture marlowcharite  Â·  3Comments

angerman picture angerman  Â·  3Comments

Z-JaDe picture Z-JaDe  Â·  3Comments

acecilia picture acecilia  Â·  3Comments

trungp picture trungp  Â·  3Comments