The live view is not visible due to having zero width and zero height

Recently I started to learn swift from Apple app design workbook. There is a simple exercise, you should display an interactive map, but I encountered an error, which I cannot google anywhere. After starting the code Playground displays an error "The live view is not visible due to having zero width and zero height". There are only 3 lines of code. Any one have any idea what is going wrong, or what I can do?

import PlaygroundSupport
import MapKit
PlaygroundPage.current.liveView = MKMapView()

Answered by Moni11 in 710017022

Adding this code to the last line worked for me:

PlaygroundPage.current.liveView = MKMapView(frame: CGRect(x: 0, y: 0, width: 400, height: 800))

Accepted Answer

Adding this code to the last line worked for me:

PlaygroundPage.current.liveView = MKMapView(frame: CGRect(x: 0, y: 0, width: 400, height: 800))

The live view is not visible due to having zero width and zero height
 
 
Q