Document
https://developer.apple.com/documentation/coredata/setting_up_a_core_data_stack
Version
> xcodebuild -version
Xcode 13.1
Build version 13A1030d
Issue
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// ERROR: Cannot find 'window' in scope
if let rootVC = window?.rootViewController as? ViewController {
rootVC.container = persistentContainer
}
return true
}
}
Error message: "Cannot find 'window' in scope"
I get this error and can't build. What should I do?
Should I create the window myself?
Post
Replies
Boosts
Views
Activity
Development Environment
iOS 15.0
Xcode 13.1
Issue
When I execute 'PullToRefresh' with the following code, the updated View is displayed in the position where it is not pulled down by one frame.
I don't want this to appear, what should I do?
import SwiftUI
struct ContentView: View {
struct Ocean: Identifiable {
let name: String
let id = UUID()
}
@State var oceans = [
Ocean(name: "Pacific"),
Ocean(name: "Atlantic"),
Ocean(name: "Indian"),
Ocean(name: "Southern"),
Ocean(name: "Arctic")
]
var body: some View {
List(oceans) {
Text($0.name)
}
.refreshable {
oceans.shuffle()
}
}
}
gif
https://user-images.githubusercontent.com/37968814/161238304-e795377f-0d9b-4164-b039-adab9ec8e247.gif
The second PullToRefresh of gif is the relevant issue.
What I want to do
Press Button
The screen rotates (Can be executed with the following code so far)
Change the size of the Rectangle (eg. height from 250 to 100)
import SwiftUI
struct ContentView: View {
@State private var flag = false
var body: some View {
VStack {
Rectangle()
.fill(.blue)
.frame(height: 250)
.rotationEffect(Angle.degrees(flag ? 90 : 0))
.animation(.easeInOut(duration: 1), value: flag)
Button("toggle") {
flag.toggle()
}
}
}
}
How can I use SwiftUI for continuous animation such as rotation → resizing ?