これは私がやっていることです。 "ride cells"が1つのpageControllerViewにリンクされた異なる "乗り物"のテーブルを作ったが、その特定の乗り物についての静的な情報(var)にリンクさせたい。つまり、テーブルビューのRideCellをクリックすると、ページビューに保存されている特定の「ライド」情報にリンクされ、一般的なページビューにはリンクされません。'[Page]'の値を期待される要素タイプ 'Page'に変換できません。
エラーはRide2にあり、「変換できません」と私は確信していますそれは、コードの行の末尾に情報[ページ]コンポーネントに関連していること:
func setupRides() {
let ride2 = Ride(title: "Contacts", route: "", image: #imageLiteral(resourceName: "main"), info: [tron])
// let ride3 = Ride(title: "Pirates of the Caribbean", route: "Event", image: #imageLiteral(resourceName: "pirates"), info: [Page(title: "Pirates of the Caribbean", message: "Soaring Over the Horizon (FP)", imageName: "main")])
私はちょうど私が休みにプロセスをもたらす前に、それが1上で動作するように取得しようとしています。
その他の重要なコードは次のように:
var tron: [Page] = {
let firstPage = Page(title: "Share a great listen", message: "It's free to send your books to the people in your life. Every recipient's first book is on us.", imageName: "main")
let secondPage = Page(title: "Send from your library", message: "Tap the More menu next to any book. Choose \"Send this Book\"", imageName: "main")
let thirdPage = Page(title: "Send from the player", message: "Tap the More menu in the upper corner. Choose \"Send this Book\"", imageName: "main")
return [firstPage, secondPage, thirdPage]
}()
これは私のライドとページクラスがどのように見えるかです。
class Ride {
let title: String
let route: String
let image: UIImage
let info: [Page]
init(title: String, route: String, image: UIImage, info: [Page]){
self.title = title
self.route = route
self.image = image
self.info = info
}
}
class Page {
let title: String
let message: String
let imageName: String
init(title: String, message: String, imageName: String) {
self.title = title
self.message = message
self.imageName = imageName
}
}
申し訳ありませんが、これはNoobの質問です。私はそれが[Page]
として宣言されているので