Little known fact
I used to be a 3D printer technician. While working there iphone apps were all the rage in the software world. I wanted to learn. I asked my boss if they would be alright if I used my down time to build them an iOS App even though I have no idea how to do that. They said go for it.
What it did
I remember it had 4 screens. One was a unit conversion calculator (in to mm, etc). Another screen was my employer's homepage. The other 2 were just information about the app itself and what 3d printing is. I put it on the app store with the amazing name of "3D Printing".
You can too
I always forget how to make an application to display a web page so hopefully this will help me in the future. So here is what is needed after making a base cocoa app in xcode:
// ViewController.swift
import Cocoa
import WebKit
class ViewController: NSViewController {
@IBOutlet weak var webView: WKWebView!
let url = "https://buildapart.io"
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let request = URLRequest(url: URL(string: url)!)
webView.load(request)
}
}
Now CMD+R
to run the app.
I can't promise you won't have issues
Xcode is a very finicky tool. I was first trying this tutorial on my work laptop but the application would not start. This may have been that it failed to access keychain on first run to sign the application. My company's corporate policies on the laptop might prevent certain activities. If xcode doesn't display an error, try looking at the lesser known Console.app
in Applications > Utilities
folder. Good luck!
Top comments (6)
Hi, my question. I have successfully created and linked on facebook, but nothing happens when I click on photo / video on Facebook! It also does not open links to YouTube or other sites! Can someone help me please. thank you
Simple but still itΒ΄s hard to find. Most guides show you how to do this for iOS or how to do this in Mac in XIB mode. This was just what I was looking for!
Thanks for the Tutorial, But When I build for Testing It doesn't show anything at all (It states with a grey window). And When I run it on Xcode, it does work, you know how Can I solve it?
Realized the error via
Console.app
.Thanks, it worked!
thanks...
but i have one question,
how to fix window size? for example; 768px x 400px ?