Objective C Swift
(Mixing Swift Objective-C ), bridging header
, Objective C Swift. [Mixing Swift and Objective-C code in a project]
, Objective-C Swift
Swift customer → Objective-C
Xcode 10.2.1
Objective-C
File -> New -> Project... -> Cocoa Touch Static Library
Project editor -> Add a Target -> Cocoa Touch Static Library
module.modulemap
[About]
module module_name {
umbrella header "module_name-umbrella.h"
export *
}
module_name-umbrella.h
[About] .h
,
#import "header_1.h"
#import "header_2.h"
module.modulemap
module_name-umbrella.h
Copy Files
[About].
Project editor -> select a target -> Build Phases -> Copy Files -> add 'module.modulemap', 'module_name-umbrella.h'
.m
Select '.m' file -> Select File Inspectors Tab -> Target Membership -> Select the target
//or
Project editor -> select a target -> Build Phases -> Compile Sources -> add files
.h
, module_name-umbrella.h
(header_1.h
, header_2.h
)[can not do it] [public target membership]
Select '.h' file -> Select File Inspectors Tab -> Target Membership -> Select the target and make it **public**
//or
Project editor -> select a target -> Build Phases -> Headers -> add files to the **public** zone
- ⌘ Command + B Product -> Build
. , , .
[Build location]
Products group -> lib<product_name>.a -> Show in Finder
lib<product_name>.a
-include/<product_name>
Copy Files
usr/local/include
Headers
. /

Objective-C
Drag and drop
Xcode[About]
Link Library
[Undefined symbols] [Link vs Embed]
Project editor -> select a target -> General -> Linked Frameworks and Libraries -> add -> Add Others... -> point to 'lib<product_name>.a' file
Project editor -> select a target -> Build Phases -> Link Binary With Libraries -> add -> Add Others... -> point to 'lib<product_name>.a' file
Library Search paths
[Library not found for] [Recursive path]
Project editor -> select a target -> Build Settings -> Search Paths -> Library Search paths -> add path to the parent of 'lib<product_name>.a' file
Header Search Paths
[Module not found] [Recursive path]
Project editor -> select a target -> Build Settings -> Search Paths -> Header Search Paths -> add path to generated 'include/<product_name>' folder with 'module.modulemap' and '<product_name>-umbrella.h'
Swift[module_name]
import module_name