Quick Start Guide > Tutorials (Swift3) > Tutorial 01 - Linking SciChart Framework
Tutorial 01 - Linking SciChart Framework

Creating the Xcode project

In this tutorial series we will create a simple line chart using SciChart iOS. First, we need to create a new project and link SciChart framework.

If you have already created a project with linked SciChart framework, you can safely skip to Tutorial 02 - Creating a Simple Line Chart.

Source code for this tutorial can be found at our Github Repository under v2.x > Tutorials

First, ensure you have downloaded and unzipped the SciChart iOS Trial package.

Next, create a new Xcode project selecting iOS Single View application template:

  • Open Xcode and select "Create a new Project"
  • Select "Single View Application"
  • Set your project's name and Organization Identifier
  • Select Swift language
  • Select or create folder where your project will be stored



Linking the SciChart framework

Source code for this tutorial including Cocoapod setup instructions can be found at our Github Repository under v2.x > Tutorials

We suggest you two ways of how you can do this. First one is with using CocoaPods dependency manager or reference the library from installation folder.

Linking framework with CocoaPods dependency manager

 Open up Terminal and run folowing command:

           sudo gem install cocoapods

Now, still in Terminal, navigate to the folder where you've created the Xcode project and run this command:

           pod init

This command creates a new file called Podfile in the folder - open this file via TextEdit and make it as in the following box:

Copy Code
source 'https://github.com/ABTSoftware/PodSpecs.git'
platform :ios, '8.0'

target 'MyApp' do
  # Pods for MyApp
  pod 'SciChart'

Now, go back to the Terminal, which should be opened at your project's folder, and run 

      pod install command

This fetches the pod and adds it to your project.

Close the Xcode IDE and open the .xworkspace file in project's directory, which was created after our manipulations.

Once the new version of SciChart will be released you can easily update it with

       pod update

Latest SciChart version

We highly recommend you to run pod update  command right after you've installed it, to be sure you are using the latest SciChart version

Referencing from Installation Directory.

Now, let's link SciChart.framework file. To do this we need to add framwork file in "Embedded Binaries" section.
Follow these steps to do that:

  • Click on your Project in Navigator and select its target
  • In the "General" tab scroll right to the bottom
  • Click on "+" in the "Embedded Frameworks and Libraries" section
  • Click on "Add others..." button in appeared dialog
  • Select the framework file

Copy local option

You might have noticed the "Copy item local...". When you choose this option, the Xcode will copy the file you are adding locally. I don't want this to be happened you have to, first of all uncheck this option, and at second set the Frameworks Search Paths  property which you can find in Build Settings tab

Take a look at the following gif for a better understanding:



Important thing to check is that the linked scichart.framework file should be placed in both sections - "Embedded Binaries" and "Linked Frameworks and Libraries". Now your project has a link to SciChart framework.

Keep the framework file in the same folder

We suggest you to copy the framework file into your project's folder, and then link the framework file. This will help you to avoid the situation when you unintentionally moved or deleted the folder where the SciChart framework file was placed.

Adding SCIGenericWrapper.swift file

The final step, but one of the most important, is to add SCIGenericWrapper.swift to the Compile Sources section.
To do this, click on your project, then click on Build Phases tab and go to Compile Sources section. Click on "+" button. In selection dialog window click on the "Add Other..".
In the appeared popup go to the directory, where you saved the SciChart.framework file.
Double click on the framework file. Go to SwiftUtil folder and select SCIGenericWrapper file:



At this point the project should build and run, however we now need to add some data to be displayed as well as some basic functionality. 


See Also