我的 podspec 看起来像这样:
Pod::Spec.new do |s|
s.name = 'flutter_vlc_player'
s.version = '0.0.3'
s.summary = 'A new Flutter project.'
s.description = <<-DESC
A new Flutter project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'MobileVLCKit', '~> 3.3.10'
s.static_framework = true
s.ios.deployment_target = '9.0'
end
Run Code Online (Sandbox Code Playgroud)
如何设置:modular_headers => truefor s.dependency 'MobileVLCKit', '~> 3.3.10'?我试着用像 …
在这个答案中,该解决方案适用于 Scene plus swiftUI。
但是使用@main 就像:
@main
struct MyApp: App {
@StateObject private var model = MyModel()
var body: some Scene {
WindowGroup {
Router {
AppContent()
}.environmentObject(self.model)
}
}
}
Run Code Online (Sandbox Code Playgroud)
我还尝试通过使用获取主窗口
var window: NSWindow? {
let window = NSApplication.shared.mainWindow
return window
}
Run Code Online (Sandbox Code Playgroud)
尽管如此,mainWindow总是返回nil
我需要NSWindow由于需要符合ASWebAuthenticationPresentationContextProviding哪些有义务返回NSWindow. 基本上,我正在尝试执行以下操作:
LoginView(store: AuthStore(window: window))
Run Code Online (Sandbox Code Playgroud)
WhereAuthStore用于AuthenticationServices执行身份验证。
I was trying to use a pod that was written in Obj-C and my project is Swift-only.
I got this error include of a non-modular header inside framework module in the import statement of a dependency inside the framework .h file.
The pod spec of the library is:
Pod::Spec.new do |s|
s.name = 'flutter_vlc_player'
s.version = '0.0.3'
s.summary = 'A new Flutter project.'
s.description = <<-DESC
A new Flutter project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Widget 上下文预览一些视图,例如:
\nstruct MyTasksView_Previews: PreviewProvider {\n static var previews: some View {\n MyTasksView(\n myTasks: Fake.myTasks,\n user: Fake.user,\n error: ""\n )\n .previewContext(WidgetPreviewContext(family: .systemMedium))\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n但是,我在尝试运行预览时收到此错误。而且,我不确定为什么会发生这种情况。
\n\n\nRemoteHumanReadableError:未知的预览提供程序 \xe2\x80\x9cMyTasksView_Previews\xe2\x80\x9d\nMyApp 不包含名为 \xe2\x80\x9cMyTasksView_Previews\xe2\x80\x9d 的预览提供程序。检查您的构建设置以确保预览提供程序已编译到您的产品中。
\n
我也尝试使用简单的Text(text).previewContext(WidgetPreviewContext(family: .systemMedium)),但它也不起作用。我正在使用 Xcode beta 5。
在 WWDC 2020 的 Apple Emoji Rangers Demo App 中,我们可以看到这段代码进行预览:
\nstruct CharacterNameView_Previews: PreviewProvider {\n static var previews: some View {\n CharacterNameView(CharacterDetail.panda)\n .previewContext(WidgetPreviewContext(family: .systemSmall))\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n