Content-Length: 253189 | pFad | https://github.com/NativeScript/nativescript-cli/pull/5830

2A feat(ios): allow collections of NativeSource to be included via nativescript.config by NathanWalker · Pull Request #5830 · NativeScript/nativescript-cli · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ios): allow collections of NativeSource to be included via nativescript.config #5830

Merged
merged 2 commits into from
Feb 22, 2025

Conversation

NathanWalker
Copy link
Contributor

@NathanWalker NathanWalker commented Feb 15, 2025

PR Checklist

What is the current behavior?

Right now, developers are forced to include iOS native source code via plugins (Obj-C, Swift) or within single project location: App_Resources/iOS/src.

There's also an option to create a local Swift Package to house shared native source code to be consumed by the project (via the current SPMPackages option of config: https://docs.nativescript.org/configuration/nativescript#ios-spmpackages). This can be a fine option in some cases however comes with some overhead in that Swift Packages have member access considerations (meaning generally would need to have proper public access modifiers including proper public initializers for accessing from the swift package).

What is the new behavior?

This allows a long desired ability to include native source code from anywhere in the project including outside the project directory given workspace setups. For example, developers can now configure nativescript.config as follows:

  • Including any .swift files anywhere within project/src directory:
ios: {
    NativeSource: [
      {
        name: 'ProjectPlatformSrc',
        path: './src/**/*.swift'
      }
    ],

This will create a file reference folder named ProjectPlatformSrc within the generated Xcode project containing any .swift files found anywhere within the projects src directory.

  • Including any .swift files anywhere within project/src directory, including any (Swift, Obj-c impl/headers, as well as any module.modulemap files) within workspace packages or libs dir:
ios: {
    NativeSource: [
      {
        name: 'ProjectPlatformSrc',
        path: './src/**/*.swift'
      },
      {
        name: 'Auth',
        path: '../../packages/**/*.{swift,m,h,modulemap}'
      },
      {
        name: 'Purchasing',
        path: '../../libs/**/*.{swift,m,h,modulemap}'
      }
    ],

Doc added: NativeScript/docs#161

@NathanWalker NathanWalker force-pushed the feat/config-shared-ios-src-directories branch from 5970b46 to ee25c82 Compare February 22, 2025 16:29
@NathanWalker NathanWalker merged commit daa567c into main Feb 22, 2025
@NathanWalker NathanWalker deleted the feat/config-shared-ios-src-directories branch February 22, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/NativeScript/nativescript-cli/pull/5830

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy