我试图隐藏列表中单元格之间的分隔线,但根据 Apple 的文档,似乎没有办法做到这一点。
知道怎么做吗?
我有一个包含多个目标的 Xcode 项目。其中一个目标针对 tvOS 平台。我的其他目标使用不支持 tvOS 的“youtube-iso-player-helper”框架。我想要一个 Cocoapod Podfile,它只包含 iOS 上的播放器框架。
这是我当前的 Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
platform :tvos, '9.0'
use_frameworks!
pod 'SVGgh'
pod "youtube-ios-player-helper", "~> 0.1"
xcodeproj 'MyProject.xcodeproj'
Run Code Online (Sandbox Code Playgroud)
当我尝试更新 Pod 时,出现以下错误:
[!] 目标平台
Pods
(tvOS 9.0)不兼容youtube-ios-player-helper (0.1.4)
,不支持tvos
.
显然,这是使用当前版本的 Cocoapods。
所以,我需要知道我的 Podfile 所需的语法。
我找不到方法或好的教程来解释如何将 UIViewController 拥有的变量(String 或 Int)的值传递给调用该视图的 SwiftUI 视图。
例如:
class ViewController: UIViewController {
var myString : String = "" // variable of interest
....
func methodThatChangeValueOfString(){
myString = someValue
}
}
// to make the view callable on SwiftUI
extension ViewController: UIViewControllerRepresentable {
typealias UIViewControllerType = ViewController
public func makeUIViewController(context: UIViewControllerRepresentableContext<ViewController>) -> ViewController {
return ViewController()
}
func updateUIViewController(_ uiViewController: ViewController, context: UIViewControllerRepresentableContext<ViewController>) {
}
}
Run Code Online (Sandbox Code Playgroud)
在 SwiftUI 中我会有
struct ContentView: View {
var body: some View {
ViewController()
}
} …
Run Code Online (Sandbox Code Playgroud)