Skip to content

Migrate package to use swift package manager - #156

Open
jslattery26 wants to merge 8 commits into
nordicsemi:mainfrom
jslattery26packages:refac/migrate_to_spm
Open

jslattery26 wants to merge 8 commits into
nordicsemi:mainfrom
jslattery26packages:refac/migrate_to_spm

Conversation

@jslattery26

Copy link
Copy Markdown
Contributor

still backwards compatible with cocoapods

In Flutter 3.44, Swift Package Manager (SwiftPM) officially replaced CocoaPods as the default dependency manager for iOS and macOS applications. This change aims to simplify development by removing the dependency on Ruby and manual CocoaPods installations for new projects.

@philips77 philips77 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR!

Why did you move all the darvin/Classes code to mcumgr_flutter/Sources/mcumgr_flutter? Perhaps we could get rid of one of these mcumgr_fluitter?

I also did some comments to the code.

Comment thread pigeon/mcumgr_methods.dart Outdated
kotlinOut: 'android/src/main/kotlin/no/nordicsemi/android/mcumgr_flutter/Messages.g.kt',
kotlinOptions: KotlinOptions(package: "no.nordicsemi.android.mcumgr_flutter"),
swiftOut: 'darwin/Classes/Messages.g.swift',
swiftOut: 'ios/mcumgr_flutter/Sources/mcumgr_flutter/messages.g.swift',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be darvin, not ios?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, i didn't change it from the migration step.

Screenshot 2026-06-01 at 10 57 55 AM

Comment thread pubspec.yaml
Comment thread pigeon/mcumgr_methods.dart Outdated
int? opOverride,
int? flagsOverride,
);
void setupDecorator(String remoteId, Uint8List? suffix, int? opOverride, int? flagsOverride);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it more readable in multiple lines? Below as well.

self.logCategory = category
self.logLevel = level
self.logDateTime = Int64(timeInterval * 1000)
logCategory = category

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These self were here to keep the style the same. It needs to be in message, but following properties look better if they are also prefixed like that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I think this is my swift formatting, i'll have to fix these ones

return .default
case .shell: return .shell
case .suit: return .suit
case .memfault: return .default

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a new category instead of defaulting? The default is not a default category... it's just an unfortunate name for the "OS Manager" which historically been named Default Manager.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@jslattery26

Copy link
Copy Markdown
Contributor Author

The reason a lot of files were moved was because I followed this migration guide, and this might answer some of your other questions:
https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors#how-to-add-swift-package-manager-support-to-an-existing-flutter-plugin

@jslattery26

Copy link
Copy Markdown
Contributor Author

@philips77 I think I resolved all of the issues. Let me know if theres anything else i can do. I appreciate the in-depth review

@dinesharjani

Copy link
Copy Markdown
Contributor

@philips77 ping :) (We're in August, already)

@dinesharjani

Copy link
Copy Markdown
Contributor

PSA: I believe @philips77 wanted to do some thorough testing before merging into main. Unfortunately he's on much needed vacation at the moment. We will resume work on late August / early September. Sorry to everyone waiting for this for the delay. You're welcome to provide additional feedback if you consider this branch to be in good shape to merge.

@Gaby-Torres

Copy link
Copy Markdown

Hi @dinesharjani @philips77 any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants