Giter Site home page Giter Site logo

Combine about swiftuipdf HOT 4 OPEN

ketyung avatar ketyung commented on July 28, 2024
Combine

from swiftuipdf.

Comments (4)

ketyung avatar ketyung commented on July 28, 2024 1

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.

ketyung avatar ketyung commented on July 28, 2024

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.

myanalysis avatar myanalysis commented on July 28, 2024

from swiftuipdf.

AJ-Duncan-Poole avatar AJ-Duncan-Poole commented on July 28, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.