Skip to content

Instantly share code, notes, and snippets.

@MatrixSenpai
Created June 21, 2021 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatrixSenpai/6a00fb63bcb52d7fb86a67fb5fdf4f3e to your computer and use it in GitHub Desktop.
Save MatrixSenpai/6a00fb63bcb52d7fb86a67fb5fdf4f3e to your computer and use it in GitHub Desktop.
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .white
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 150, height: 150))
let url = URL(string: "https://images.contentstack.io/v3/assets/blt731acb42bb3d1659/blt1941a709e8a4a20f/609ae4787ee89a47ff53a865/WRObsidianPoro_512.jpg")!
let data = try? Data(contentsOf: url)
let image = UIImage(data: data!)
imageView.image = image
view.addSubview(imageView)
self.view = view
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment