heckj / swiftui-notes

content for Using Combine - notes on learning Combine with UIKit and SwiftUI

Home Page:https://heckj.github.io/swiftui-notes/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect code example onreceive only works on statement not definitions

alexbbrown opened this issue · comments

“The onReceive function takes a closure”

The code example below shows something like

Var x: View { Text() }.onReceive { } 

But declarations don’t work that way. You need to attach on receive to the inner view

thanks @alexbbrown, ill get that updated. i need to make a full example for that, and when i originally wrote it, i didnt have Catalina to really work swiftui easily. no excuse now, just need to do it.