Git Product home page Git Product logo

Comments (5)

kaandedeoglu avatar kaandedeoglu commented on August 26, 2024 1

@mickeyl Hey sorry I seem to miss this command, but that's a great idea! As we're already reading the xcodeproj file, and require a target to work on, we can perhaps detect iOS / macOS and generate as such..

For SwiftUI though, perhaps there's no way to easily detect this as you said. There's also the case where the app uses a mix of (UIKit || AppKit) & SwiftUI. Let me explore whether having --platform consume multiple options does the trick 😊

from shark.

kaandedeoglu avatar kaandedeoglu commented on August 26, 2024

Hey @mickeyl
That's a great question, and no I haven't considered it until now. That being said, I see a lot of nice opportunities there. One advantage we have is reading the Xcodeproj file to generate the Shark.swift file. So potentially we could detect what kind of application the target is (UIKit / AppKit) to generate the correct UIImage / NSImage counterparts without having to do #if canImport(UIKit) dances.

I'm not very experienced in AppKit so it'll need to do some exploration :)

from shark.

mickeyl avatar mickeyl commented on August 26, 2024

Inspecting the buildSettings is certainly the first step towards an automatic detection of the target type. There is, e.g.,

SDKROOT = macosx; and SDKROOT = iphoneos;, respectively.

This will not help to detect SwiftUI though, which is my current playfield. SwiftUI has its own set of abstractions for colors and images and it builds targets for both iOS and macOS.

It looks like for a reliable auto-detection, we would need to query the source files and check whether @main is used anywhere.

To be honest, I'm not so sure whether auto-detection is worth the hassle. It might be a better (and more simple) approach to just select the platform via a --platform command line switch:

--platform UIKit
--platform AppKit
--platform SwiftUI

or

--platform iOS
--platform macOS
--platform SwiftUI

from shark.

mickeyl avatar mickeyl commented on August 26, 2024

https://github.com/kaandedeoglu/Shark/tree/wip/framework-specific-code-generation now contains a preview of the code generation for AppKit and SwiftUI. Choose it by supplying the new --framework option with appkit, or swiftui. I'd appreciate testing, in particular with the newly supported frameworks.

from shark.

mickeyl avatar mickeyl commented on August 26, 2024

This has now merged to master and a new release (1.4.0) has been cut.

from shark.

Related Issues (20)

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.