> ## Content Index
> Fetch the complete content index at: https://blogs.remobjects.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Using DataAbstract and RemObject SDK for Cocoa libraries in Swift
- URL: https://blogs.remobjects.com/2014/09/01/using-dataabstract-and-remobject-sdk-for-cocoa-libraries-in-swift/
- Published: 2014-09-01T18:48:08.000Z
- Updated: 2018-08-22T06:17:38.000Z
- Author: alexk
- Tags: #Import 2026-08-17 20:17

As you probably already know, Apple recently announced a new programming language called *Swift*, a new and fresh look at programming for the Mac.  
The main and obvious purpose of *Swift* is to replace *Objective-C* in the future.

To develop for the Mac, RemObject Software offers two products, [DataAbstract for Cocoa](http://wiki.remobjects.com/wiki/Data%5FAbstract%5Ffor%5FXcode?ref=blogs.remobjects.com) and [RemObject SDK for Cocoa](http://wiki.remobjects.com/wiki/RemObjects%5FSDK%5Ffor%5FXcode?ref=blogs.remobjects.com).  
These products are designed using native Apple technologies and are written in *Objective-C*.  
They are available as frameworks and as static libraries.

This brings us to the important question: Can I use existing libraries written in Objective-C in a program written in Swift?

The answer to that question is yes.

In order to access classes from *Objective-C* libraries from *Swift*, you need to create a so-called *Bridging Header File* and name it according to your product module name followed by *\-Bridging-Header.h*.  
Then you need to edit this file to expose your *Objective-C* code to your *Swift* code.  
Just import every \*Objective-C \* header you want to expose to Swift. In our case, this will be the root Data Abstract header:

| //// DAWithSwift-Bridging-Header.h// #import |
| -------------------------------------------- |

Then go to the project settings and locate the “Swift Compiler – Code Generation” section at the “Build Settings” tab, where you need to specify the bridge header file for the “Objective-C Bridging Header” build setting. The path must go directly to the file itself, not to the directory it’s in. The path should be relative to your project, similar to the way your Info.plist path is specified in Build Settings. For example:

DAWithSwift/DAWithSwift-Bridging-Header.h

Also, do not forget to set the other build options to allow your application to locate and link it with the RemObjects libraries:

Library Search Path = "/Developer/RemObjects Software/Bin/$(CONFIGURATION)$(EFFECTIVE\_PLATFORM\_NAME)" Other Linker Flags = -ObjC -all\_load -lxml2 -lDataAbstract

And that’s it, now all public *Objective-C* headers listed in this bridging header file will be visible to *Swift*.

The *Objective-C* functionality will be available in any *Swift* file within that project automatically, without any import statements.  
You can now use DA/RO classes with the same *Swift* syntax that you can use with system classes.

| //SWIFT // Set up rda and server accessvar dataAdapter: DARemoteDataAdapter let url: NSURL \= NSURL(string:"http://localhost:7099/bin")self.dataAdapter\= DARemoteDataAdapter(targetURL:url) dataAdapter.dataService.serviceName\= "DataService" println("dataAdapter: \\(dataAdapter.dataService.channel.targetURL)") |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

At the moment, most of \*Swift\* is covered by the Apple NDA until it is released, but after that we are going to simplify even those steps above.

Thanks for reading!