Kevin_Nye
(Kevin Nye)
1
The progress indicator has no animation & the Facebook app uses Adobe so when I test my app the game won’t load.
Here’s my code:
import Cocoa
import WebKit
class ViewController: NSViewController {
@IBOutlet weak var webView: WebView!
@IBOutlet weak var progressIndicator: NSProgressIndicator!
override func viewDidLoad() {
super.viewDidLoad()
let urlString = "https://apps.facebook.com/thetribez"
self.webView.mainFrame.loadRequest(NSURLRequest(URL: NSURL(string: urlString)!))
}
override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
}
func webView(sender: WebView!, didStartProvisionalLoadForFrame frame: WebFrame!)
{
self.progressIndicator.startAnimation(self)
}
func webView(sender: WebView!, didFinishLoadForFrame frame: WebFrame!)
{
self.progressIndicator.stopAnimation(self)
}
}
The progress indicator has no animation & the Facebook app uses Adobe so when I test my app the game won’t load.
This is more a Cocoa question than a Swift question, but as far as the progress indicator is concerned, I would check that the appropriate delegate outlet (I think there are three or four for a WebView) is connected in your nib file. If it’s not, your webView(_:didWhateverLoadForFrame:) methods will never be called, and they’ll never know to start the animation. I don’t really understand what you mean by the other question.
I might also look at WKWebView instead of the older WebView. WKWebView has a much more modern and coding-safety-oriented API, and seems to be recommended for new code where possible.
···
--
Brent Royal-Gordon
Architechies