Terry Bu
Terry Bu

Reputation: 899

Getting filter and map chaining to work on ReactiveCocoa 3.0 beta swift

secondTextField.rac_textSignal()
        .map { (value: AnyObject!) -> Int in
            let textFromField = value as! NSString
            return textFromField.length
     **line   }.filter { (filter: AnyObject!) -> Bool in
            let textLength = filter as! Int
            return textLength > 3
        }

line marked **line gives Swift compiler error ... Cannot invoke 'filter' with an argument list of type '((AnyObject!) -> Bool)' ... what gives??

Upvotes: 0

Views: 249

Answers (1)

ReDetection
ReDetection

Reputation: 3196

Because this line isn't actual failed line of code. Try to change return type of closure in the map call to return AnyObject. Xcode isn't very accurate when dealing with Swift yet.

        .map { (value: AnyObject!) -> AnyObject in

Upvotes: 3

Related Questions