This is for testing only. Do you have xcframework archived as a zip ? I've seen only tar.gz
Alexandru Tudose (808e5b81) at 28 Jan 08:19
Update Packaging/buildAndDeployFrameworks.sh
The zip archive can contain additional files so it should go along with cocoapods (a small change is to not create a intermediary root directory inside archive as is it right now.)
Another issue might be that, when Package is added to Xcode, it will download all 3 zip files (generate extra traffic) even if inside the app only 1 is linked to the target.
From what I saw, in order do have separate packages for each platform we need to have separate git repository each one with its Package.swift file. Or maybe to use branches, ex: spm-mobile, spm-tv.
Updated buildAndDeployFrameworks.sh script to generate zip build and update Package.swift file
Alexandru Tudose (17a38369) at 25 Jan 10:10
Swift package support.
Not sure what is the right approach here, I've seen that you use buildAndDeployFrameworks that also need to be updated in order to update Package.swift file.
I was thinking to have a Package.swift file in Packaging directory, and a symlink at the root, ex:
ln -s Packaging/Package.swift Package.swift
By pull request you mean on GitHub right ?
Yep, I'm interested to help in order to have SPM support...
In order to support SPM, a "Package.swift" should be placed at the root level. Currently information for distributing binaries for VLCKit are placed in "Packaging" directory.
The archive should be zipped and only xcframework format is supported.
I have test it using a fork https://github.com/alextud/vlckit
Example of Package.swift
let package = Package(
name: "VLCKit",
products: [
.library(name: "TVVLCKit", targets: ["TVVLCKit"]),
.library(name: "MobileVLCKit", targets: ["MobileVLCKit"]),
.library(name: "VLCKit", targets: ["VLCKit"]),
],
targets: [
.binaryTarget(
name: "TVVLCKit",
url: "https://test-vlc.s3.eu-central-1.amazonaws.com/TVVLCKit.xcframework.zip",
checksum: "f8e97eb6de2acd56a3ee56982c308e65175d10869fb36b25b34af2a4dda742c7"
),
.binaryTarget(
name: "MobileVLCKit",
url: "https://test-vlc.s3.eu-central-1.amazonaws.com/MobileVLCKit.xcframework.zip",
checksum: "32a644ffac74eb2d423c148509df7c2cbcfc311e085ad074632eed22826b456b"
),
.binaryTarget(
name: "VLCKit",
url: "https://test-vlc.s3.eu-central-1.amazonaws.com/VLCKit.xcframework.zip",
checksum: "0473d1fe8228bf1833f6798ff70d1fd2294c745c3a5c93d073c4843f88446253"
),
]
)
Checksum is calculated using:
swift package compute-checksum VLCKit.xcframework.zip
I use this workaround:
struct VLCPlayerView_MAC: NSViewRepresentable { var mediaplayer = VLCMediaPlayer()
///https://code.videolan.org/videolan/vlc/-/issues/25264
@State var fixedFirstTimeInvalidSize = false
func makeNSView(context: Context) -> NSView {
let view = NSView()
fixFirstTimeInvalidSize(view: view)
return view
}
func updateNSView(_ view: NSView, context: Context) {
mediaplayer.drawable = view
}
func fixFirstTimeInvalidSize(view: NSView) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.005) {
if !fixedFirstTimeInvalidSize && !mediaplayer.hasVideoOut {
fixFirstTimeInvalidSize(view: view) // delay
return
}
if !fixedFirstTimeInvalidSize, var frame = view.window?.frame {
frame.size.height += 1
view.window?.setFrame(frame, display: true)
fixedFirstTimeInvalidSize = true
// revert back
DispatchQueue.main.async {
frame.size.height -= 1
view.window?.setFrame(frame, display: true)
}
}
}
}
}