Swift Archives - Nabtron Technology & Programming Guide Mon, 11 Nov 2019 12:45:06 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 https://i0.wp.com/nabtron.com/wp-content/uploads/2018/12/nabtron-icon-50.jpg?fit=32%2C32&ssl=1 Swift Archives - Nabtron 32 32 13047128 How to use CommonCrypto for HMAC in Swift 4 https://nabtron.com/commoncrypto-hmac-swift/ https://nabtron.com/commoncrypto-hmac-swift/#comments Mon, 07 May 2018 19:59:37 +0000 https://nabtron.com/?p=10471 After numerous hours trying to understand how CommonCrypto works with xCode and how to use it to generate a hmac hash, I finally made it work! In this tutorial you will see how to: What is CommonCrypto library and why to use it How to include CommonCrypto (and CommonHMAC) in your xcode project How to […]

The post How to use CommonCrypto for HMAC in Swift 4 appeared first on Nabtron.

]]>
https://nabtron.com/commoncrypto-hmac-swift/feed/ 2 10471
Swift timer example – Repeat action https://nabtron.com/swift-timer-example-repeat-action/ https://nabtron.com/swift-timer-example-repeat-action/#respond Mon, 26 Dec 2016 20:27:25 +0000 https://nabtron.com/?p=10338 This tutorial will go through how to make an action repeat itself after a specific interval of time as a swift timer example. This code is written and verified on macbook pro using: XCode 8.2 Swift 3.0.2 MacOS Sierra 10.12.2 How to make an action repeat using Timer in Swift Lets understand swift 3 timer […]

The post Swift timer example – Repeat action appeared first on Nabtron.

]]>
https://nabtron.com/swift-timer-example-repeat-action/feed/ 0 10338
Show notification in cocoa xcode app using Swift 3.0.1 https://nabtron.com/show-notification-cocoa-xcode-swift/ https://nabtron.com/show-notification-cocoa-xcode-swift/#comments Mon, 26 Dec 2016 19:49:20 +0000 https://nabtron.com/?p=10336 This tutorial explains how to show a notification on macOS app. This code will work for a cocoa app built using xcode using swift 3.0.1. This code is written and verified on macbook pro running: XCode 8.2 Swift 3.0.1 MacOS Sierra 10.12.2 How to show notification in cocoa xcode app using Swift 3.0.1 Follow these […]

The post Show notification in cocoa xcode app using Swift 3.0.1 appeared first on Nabtron.

]]>
https://nabtron.com/show-notification-cocoa-xcode-swift/feed/ 2 10336
Quit Cocoa App when Window Close using XCode Swift 3 https://nabtron.com/quit-cocoa-app-window-close/ https://nabtron.com/quit-cocoa-app-window-close/#comments Sat, 24 Dec 2016 21:21:48 +0000 https://nabtron.com/?p=10297 The default behaviour of XCode Cocoa Mac OS app is that when the window close button is it, it simply closes the app window. However the App doesn’t quit. Which means that the app is still running and when we try launching it again, nothing will happen. We have to manually quit the appĀ (e.g. by […]

The post Quit Cocoa App when Window Close using XCode Swift 3 appeared first on Nabtron.

]]>
https://nabtron.com/quit-cocoa-app-window-close/feed/ 4 10297
Rounding Double in Swift https://nabtron.com/rounding-double-swift/ https://nabtron.com/rounding-double-swift/#respond Fri, 23 Dec 2016 02:55:25 +0000 https://nabtron.com/?p=10286 Rounding a Double in swift is quite simple and easy (tested up to swift 5.1). We simply need to use the round() function provided by swift. The example below will demonstrate how to use this function effectively, while keeping your number still a Double (without changing the type). This example has been tested in xcode […]

The post Rounding Double in Swift appeared first on Nabtron.

]]>
https://nabtron.com/rounding-double-swift/feed/ 0 10286
Stride Swift 3.0.1 https://nabtron.com/stride-swift/ https://nabtron.com/stride-swift/#respond Thu, 22 Dec 2016 21:50:16 +0000 https://nabtron.com/?p=10283 Stride is an amazing and special feature in Swift (language by apple) which replaces the conventional c-style for statement loops. Stride() is used to loop over a range of numbers. This range can be moved using any increment. Lets look at three examples to understand three possible applications of stride in swift 3.0.1 code. Conventional […]

The post Stride Swift 3.0.1 appeared first on Nabtron.

]]>
https://nabtron.com/stride-swift/feed/ 0 10283