brainflow-dev / brainflow

BrainFlow is a library intended to obtain, parse and analyze EEG, EMG, ECG and other kinds of data from biosensors
https://brainflow.org/
MIT License
1.27k stars 327 forks source link

Swift bindings #716

Open ScottThomasMiller opened 4 months ago

ScottThomasMiller commented 4 months ago

CI for Swift bindings.

ScottThomasMiller commented 4 months ago

Cleanup is complete. Build and CI are good. Should I open a new PR?

Andrey1994 commented 4 months ago

no, lets keep in this one, just push your changes to the same brach

ScottThomasMiller commented 4 months ago

All changes pushed. All checks passed. The PR is ready for your review.

Andrey1994 commented 4 months ago

Also need to rename examples from main.swift, here is a full list:

        deleted:    ../swift_package/examples/tests/band_power/main.swift
        deleted:    ../swift_package/examples/tests/band_power_all/main.swift
        deleted:    ../swift_package/examples/tests/denoising/main.swift
        deleted:    ../swift_package/examples/tests/downsampling/main.swift
        deleted:    ../swift_package/examples/tests/ica/main.swift
        deleted:    ../swift_package/examples/tests/read_write_file/main.swift
        deleted:    ../swift_package/examples/tests/signal_filtering/main.swift
        deleted:    ../swift_package/examples/tests/transforms/main.swift
Andrey1994 commented 4 months ago

I also merged master branch to this one and added docs about swift, would be good if you take a look and maybe add details how to build it using xcode. File is docs/BuildBrainFlow.rst

ScottThomasMiller commented 4 months ago

Due to a strange issue with Xcode, the example test files must be named main.swift, unless the test file contains ArgumentParser, in which case it must be named the same as the top-level struct (for example, eeg_metrics.) I can try to find a workaround. Maybe I can just add ArgumentParser to all of the tests, even the ones that don't actually need it?

I figured it out. I used the @main decorator instead of the main.swift filename.

ScottThomasMiller commented 4 months ago

I added instructions to docs/BuildBrainFlow.rst.

ScottThomasMiller commented 4 months ago

I made all of the updates except I have not yet changed the main.swift filenames. The build is failing at the following line:

  builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks -rename /Users/runner/Library/Developer/Xcode/DerivedData/BrainFlowCI-hfqdqfivnwvgoqhhucaczbqmqols/Build/Intermediates.noindex/ArchiveIntermediates/band_power/IntermediateBuildFilesPath/BrainFlowCI.build/Release/band_power.build/Objects-normal/arm64/band_power.swiftdoc /Users/runner/Library/Developer/Xcode/DerivedData/BrainFlowCI-hfqdqfivnwvgoqhhucaczbqmqols/Build/Intermediates.noindex/ArchiveIntermediates/band_power/BuildProductsPath/Release/band_power.swiftmodule/arm64-apple-macos.swiftdoc

Error: Process completed with exit code 65.
Andrey1994 commented 4 months ago

I think you are missing hidden conversations, there are more comments if you expand them

Andrey1994 commented 4 months ago

for example - https://github.com/brainflow-dev/brainflow/pull/716/files/a2c526a09dd43e391bd59be5fa4af2407091acf7#r1575460864 if you scroll messages in this PR and expand hidden conversations you will see this

ScottThomasMiller commented 4 months ago

Indeed I did! I am working on the missed comments now.

ScottThomasMiller commented 4 months ago

The build is clean except for this error:

Deploy Cpp libs / CppUnix (Debug, macos-11.0) Cancelled

I'm not sure what that's from. My swift_package CI looks good; no errors. I think the only thing remaining are the comments for the docs. I will work on that next.