Deallocate WindowController + ?

(macOS) In my AppDelegate I have “menu > new window” as an array of WindowControllers (+ ViewController / View with WKWebView), if I close the window and remove the WC from the array I don’t think everything is deallocated from the memory. Not sure what the right practive is to make sure it’s all removed (inc. WKWebView).


Any suggestions ?

Powered by WPeMatico

EXC_BAD_INSTRUCTION error with webview

I was just working on a web browser that I decided to makein xcode with swift when I ran into some problems. I don’t have a great understanding for the language, but with what I knew I tried and failed. The main problem is that the program will launch there are some errors in my applicationDidFinishLaunching function that I cant identify. I recieve the error exc_bad_instruction (code=exc_i386_invop subcode=0x0) and cannot solve it so any help is appreciated. Thanks in advance!



    import Cocoa

    import WebKit

    import Foundation


    class AppDelegate: NSObject, NSApplicationDelegate {


        @IBOutlet var webViewMain: WebView!

        @IBOutlet weak var window: NSWindow!


        func applicationDidFinishLaunching(_ aNotification: Notification) {


            webViewMain.shouldCloseWithWindow = true

            webViewMain.drawsBackground = true


            let rpStartURL = NSURL(string: “https:/

            let rpRequestURL = NSURLRequest(url: rpStartURL! as URL)


            self.webViewMain.mainFrame.load(rpRequestURL as URLRequest!)



        func applicationWillTerminate(_ aNotification: Notification) {





Powered by WPeMatico

How to Show Detail View Controller (Split View)

I have a UITableView that on selection changes the detail view in a split view controller. But when the switch takes place on an iPad, the nav bar gets removed. I do not want to create the navigation bar programmatically, instead I want to reference it from my interface builder storyboard. Any ideas what I’m doing wrong?


func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 
       let selectedMonster = self.HomeSections[indexPath.row] 
        let myVC = self.storyboard?.instantiateViewController(withIdentifier: selectedMonster) 

        navigationController?.showDetailViewController(myVC!, sender: self) 



Powered by WPeMatico

How to sync SQLite database between two devices through the same app?



I’m doing my first project using Xcode8 and Swift3, I wrote my database using SQLite which means it’s local storage without server. Now I wann sync database between two devices but can I do it without server? I suppose it’s quite hard.

If I can’t do it without server, I suppose I can do it with iCloud as they are using the same AppleID, but if I use iCloud, what should I do? should I change my database into coreData? if so, how?


Thank you very much!!!

Powered by WPeMatico