I have been searching for a long time and cannot find anything similar to this issue. I am new to SwiftUI and try to make a sample project.
When I launch my app, the view appears with black borders at top and bottom.
As I don't have a clue on what can go wrong, here is the SceneDelegate I have in my project.
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window : UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
self.window = UIWindow(windowScene: windowScene)
self.window?.frame = UIScreen.main.bounds
let vc = UIStoryboard(name: "Main", bundle: Bundle.main).instantiateInitialViewController()
self.window!.rootViewController = vc
self.window!.makeKeyAndVisible()
}
}
I have a storyboard containing a single UIHostingController
which is the entry point.
Here is its implementation :
class HostingViewController: UIHostingController<Text> {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder, rootView: Text("text"))
}
}
Below is a screenshot of the simulator when the app runs.
I have tried to reduce as much as possible the amount of code in the project to identify the origin of the issue but unfortunately nothing is solving this issue.
As I don't know what could go wrong maybe the snippets I linked do not show the correct part of the code. Please feel free to ask for more information if needed.
Thanks in advance for any piece of advice you could provide.