Category: Xcode

Xcode is Apple’s integrated development environment for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, and tvOS.

  • My thoughts on SwiftUI

    My thoughts on SwiftUI

    I recently completed one medium size SwiftUI project and, it was a wonderful experience with MVVM architecture. I took some time to grab everything, but my struggles been paid off.

    I no longer want to do a new project on the storyboard. You should not do it either. No fear just start you will finish it soon.

    Storyboard was some improvements than single xib file, at least you did not have to open many tabs for xib which always slowed down Xcode. But it was always like this on Apple platform since Xcode 3.2, developing app means you have to handle xib file.

    I always liked Android’s XML way than a xib file on a Xcode.

    I never liked the Auto Layout either, but it always worked on all devices. But I hated it when I had to break a few constraints to add a few more to make space for a new TextField or Image. It has never been easy.

    The most useful thing about SwiftUI that how easy it is to create a view and reuse it anywhere if you can make it in that way. The @Binding and @State are really helpful.

    And the ViewModel updates a model which your view observes always. So my ViewModel has a property @Published whenever it changes its all observers will get the update by calling the property @ObservedObject or @StateObject.

    The SwiftUI is very new but it is the best thing for app developers on Apple platforms. I even converting few more apps in SwiftUI in the coming months.

    Download a demo login app I’m working on from github.

    Spread the love
  • Complete Login App in SwiftUI

    Complete Login App in SwiftUI

    This project follows the Swift MVVM design pattern. It also includes API examples and industry-standard project structure.

    It requires a Laravel project to run in the background. The Laravel project is very simple it requires only a few simple steps.

    Clone the Laravel project

    Download the source code

    Spread the love
  • Bring macOS app to front when dock icon gets clicked

    Bring macOS app to front when dock icon gets clicked

    Implement applicationShouldHandleReopen in your AppDelegate

    func applicationShouldHandleReopen(_ sender: NSApplication,
                                           hasVisibleWindows flag: Bool) -> Bool {
            // Bring app window when dock icon gets clicked
            if !flag {
                for window: AnyObject in sender.windows {
                    window.makeKeyAndOrderFront(self)
                }
            }
            
            return true
    }
    Spread the love