I try to apply 100 day with swift course on swift playground for building app on ipad so i get some problem ,this is the contentview side code:`
import UIKit
class ViewController: UIViewController {
var pictures = [String]()
override func viewDidLoad() {
super.viewDidLoad()
let fm = FileManager.default
let path = Bundle.main.resourcePath!
let items = try! fm.contentsOfDirectory(atPath: path)
for item in items {
if item.hasPrefix("nssl") {
// this is a picture to load!
pictures.append(item)
}
}
print(pictures)
}
}
` And this is the myApp side code:
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ViewController()
}
}
}
But i got problem like; generic struct 'WindowGroup' requires that 'ViewController' conform to 'View'.
and
Static method 'buildBlock' requires that 'ViewController' conform to 'View'.
How to solve,can someone help?
Thanks.
The Swift Playgrounds iPad app uses SwiftUI, not UIKit. You are not going to be able to go through the 100 Days of Swift course with the Swift Playgrounds app.
Hacking with Swift has a 100 Days of SwiftUI course. Go through that course instead of the 100 Days of Swift course.