I am looking for a simple procedure for combining an Objective-C code from a shared library project with Swift code from an application project but have had no success so far with this sequence:
import TestLibrary
to ViewController.swiftIf I now build Test, I receive this error in ViewController.swift: No such module: ‘TestLibrary’
.
Presumably two hurdles must be overcome:
So in summary, my question is this: how can I overcome the build error even if I subsequently add let test = TestLibrary()
to ViewController.swift, i.e. how can Test (Swift code base) make use of TestLibrary (Objective-C code base)?
This procedure seems to work (for single app target):
import TestLibrary
, since both the Swift and Objective-C code will reside in the same app target#import "TestLibrary/TestLibrary.h"
Objective-C Bridging Header: Test/Test-Bridging-Header.h
for Testlet test = TestLibrary()
e.g. inside viewDidLoad
in ViewController.swiftVoila ...