Nikita Vlasenko
Nikita Vlasenko

Reputation: 4352

RxSwift tutorial example: Attribute can only be applied to types, not declarations

I am trying to go through the RxSwift tutorial here:

https://www.raywenderlich.com/138547/getting-started-with-rxswift-and-rxcocoa

After downloading their example code, and doing pod install successfully, the build is still failing. It is showing the error in the Lock.swift file and is shown below:

enter image description here

What should I do to eliminate the error and make it to run? It is disappointing that the tutorial is not up to date. Any suggestions would be greatly appreciated.

Upvotes: 3

Views: 2148

Answers (2)

enadun
enadun

Reputation: 3307

Even though the error will be gone after removing the @noescapeattribute, it's not the correct way to fix the error. Manually editing the pod files are not recommended.

To fix this error, open the terminal and heading to the project folder. Simply type pod update. After updating the pods, all the errors will be gone.

Upvotes: 7

Quoc Nguyen
Quoc Nguyen

Reputation: 3007

Just remove @noescape will fix the error. @noescape is default

func performLocked(action: () -> Void) 

Upvotes: 4

Related Questions