Comments (5)
@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.
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.
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.
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.
This has now merged to master and a new release (1.4.0) has been cut.
from shark.
Related Issues (20)
- Build issue on XCode 8.3.3 HOT 1
- Build error: The operation couldn’t be completed. (Utility.ArgumentParserError error 3.) HOT 1
- Please support Framework target HOT 1
- Build fails due to error related to localization HOT 2
- Shark.swift file contains invalid swift code when a particular font file is present HOT 1
- Run only, if necessary HOT 2
- No top-level namespace HOT 3
- NSDataAsset HOT 3
- Storyboard support HOT 4
- Add namespaces support for Colors HOT 7
- SwiftUI HOT 1
- Automatic preview updating paused HOT 4
- Make enums CaseIterable HOT 5
- Change visibility from public HOT 2
- @const
- Swift Build Plugin
- Skip Preview Assets
- Enforcement `CaseIterable` needs to be optional HOT 6
- String Catalogs HOT 2
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 shark.