Comments (4)
Oh hi, sorry, I do not have experience in SwiftUI with Mac... but I believe it's just more or less the same... had a quick look at Apple's doc https://developer.apple.com/tutorials/swiftui/creating-a-macos-app , it's just the same , views can be laid out in VStack, HStack, ZStack etc... you can apply the same MVVM approach too.
from swiftuipdf.
Hi, thanks,
surprisingly "injecting environment object with .environmentObject(ContentViewModel())" doesn't work in your project? You can inject it in your SceneDelegate if you have one or you can inject it at the app entry point @main
Btw, if you don't wanna use @EnvironmentObject , you can use either @ObservedObject or @StateObject (iOS 14 & above), but in order to pass or share your ObservedObject or StateObject to the next view, you should have the next view to have the property contentViewModel e.g. as follows: :
struct PdfPreviewView : View {
var contentViewModel : ContentViewModel
....
....
}
so with the above the PdfPreviewView should be instantiated as follows:
NavigationLink(destination : PdfPreviewView(contenViewModel : viewModel) ){
....
....
}
Note: viewModel is your Observed or State Object from your parent view .... hope it helps :)
from swiftuipdf.
from swiftuipdf.
Hello Ketyung, thank you for sharing the work done on this. Do you know of or have in your experience an example of the same working with SwiftUI for MacOS apps? I can't seem to find anything online at this point and would greatly appreciate some guidance please.
from swiftuipdf.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftuipdf.