Skip to main content Skip to footer

Getting Started with Xuni iOS and Xcode

In this blog we'll walk through getting started using Xuni iOS in Xcode, from downloading Xuni to building your first iOS app.

  • Parts 1-3 focus on setting up Xuni's iOS controls and getting familiar with resources. It's the best starting point for newcomers
  • Part 4 consists of a video that guides you through creating your first iOS app
  • In Part 5, we'll walk through licensing your app (with an accompanying video).

iOS_plus_xuni

Part 1: Downloading and Setting Up Xuni

Xuni is distributed as a set of frameworks for the iOS platform. To obtain them, you should download and install Xuni which gives you the frameworks as well as our samples. Once you've installed Xuni, you'll be able to import these frameworks into your Xcode projects. In part 4, we'll look at how to add them to your projects.

Part 2: Getting Familiar with the Documentation

As you become more familiar with Xuni, it's likely that you'll want a reference for the various features available. Xuni is available for multiple platforms, so there are multiple versions of the documentation. For iOS users, the most relevant information will be available in these two locations:

The Xuni iOS documentation includes code for Objective-C and Swift, and you'll also notice some C#. This code is meant for Xamarin.iOS users, and, for the average iOS developer, this won't come into play.

Part 3: Running the Xuni Samples

If you're evaluating Xuni iOS for the first time, the simplest and quickest way to test the controls on your personal device or the iOS simulator is to run the samples. When you install Xuni, the samples get installed at \Documents\Xuni\iOS\Samples\. You can also check out the latest samples from GoXuni on GitHub. That way you can view the code on GitHub without storing anything locally. At either location, we have several sample projects: one for each major control. These projects will work in Xcode. The projects that are included with the installer you can build and run immediately. You can also start digging into the code to play with the controls and see how they work. Xuni controls require a runtime license key, which our samples have included. Part 4 will focus on licensing new projects. There's also the Xuni Explorer demo app, which you can install from the AppStore. It's an easy way of testing out what controls and features are available without wading into any code. Now you can easily run our samples, but eventually you'll want to create your own projects using Xuni controls.

Part 4: Working with Xuni iOS in Your Xcode Project

For this part, I've created a video to demonstrate adding Xuni to an Xcode project. These videos walk you through:

  • How to add a Xuni library to an iOS app
  • How to add a Xuni control to a ViewController

Getting Started with Xuni iOS and Xcode.

Part 5: Licensing Your App

Licensing is a required step to evaluate or use Xuni's iOS controls within your own app. The Xuni controls contain runtime license validation per app. As I mentioned above, the samples already have a license key unique to that sample so they run "out of the box." You can generate runtime keys on goxuni.com. For this step I'll provide both a video guide and set of directions you can follow below.

Getting Started with Xuni iOS and Xcode. To generate a runtime key for your app:

  1. Log in to www.goxuni.com. If you don't have an account, you'll need to create one (it's free).
  2. Click License Your App. This link can also be found in the Support menu.
  3. Select Evaluation or Full, depending on the type of key you're generating.
  4. Select Objective-C or Swift and enter the name of your app, which should also be the default namespace.
  5. Click generate.
  6. Take this key and copy it into your project. The simplest way to do this is to create a new Cocoa Touch Class, named License. The outputted text from the website includes a static constant declaration for your key so it’s very easy to just paste this into your editor.
  7. Finally, in your code, before you initialize the Xuni control, set the XuniLicenseManager.Key property to your key. It's easiest to do this in the AppDelegate's didFinishLaunchingWithOptions method. The steps for Objective C and Swift are slightly different.

For Objective C: a. Import XuniCoreKit.h and License.h


#import <XuniCoreKit/XuniCoreKit.h>  
#import "License.h"  

b.In the AppDelegate's didFinishLaunchingWithOptions method, set the XuniLicenseManager key to the key you generated earlier:


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  
    [XuniLicenseManager setKey:key];  
    return YES;  
}  

For Swift: a. Import XuniCoreKit


import XuniCoreKit  

b.In the AppDelegate's didFinishLaunchingWithOptions method, set the XuniLicenseManager key to the key you generated earlier:


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {  
        XuniLicenseManager.setKey(License().key)  
        return true  
    }  

Now you should be up and running with Xuni iOS. If you decide to purchase Xuni, you'll be given a serial number. You can register that serial number on your My Account page, and when you generate new app keys, you'll be able to select your serial number rather than selecting Evaluation. For full steps on licensing, check out the documentation. Thanks for reading and thanks for evaluating Xuni!

MESCIUS inc.

comments powered by Disqus