Tuesday, November 1, 2016

Updated Projects Page

Took some time today updating our projects page. This page contains a number of learning applications that are public so you can see what we did to create these apps. We just added two new applications: Camping Directory and Windup Wars. These are my own first forays into iOS development using Swift. Thanks to Ray Wenderlich for the great game tutorial.

Friday, October 28, 2016

Simple About Box in Swift

Here is a really simple example of how to create an about box from a UIAlertController in iOS using Swift. The box displays the application icon, the current version and some text about the application:

        let alertMessage = UIAlertController(title: "Camping Directory", message: "", preferredStyle: .alert)
        
        // Application Icon
        let image = UIImage(named: "AppIcon40x40")
        
        let imageView = UIImageView(frame: CGRect(x: 115, y: 48, width: 40, height: 40))
        imageView.image = image
        imageView.layer.cornerRadius = 8.0
        imageView.clipsToBounds = true
        
        alertMessage.view.addSubview(imageView)
        
        // Application Version
        let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
        
        // Description
        var message = "\n\n\nVersion " + version! + "\n\n"
        message += "This program is..."
        
        alertMessage.message = message
        
        let action = UIAlertAction(title: "OK", style: .default, handler: nil)
        alertMessage .addAction(action)
        
        self.present(alertMessage, animated: true, completion: nil)