Current environment: Xcode10.0 Swift4.2 iOS SDK 12.1

Demo download: github.com/zColdWater/…

preface

This article will simply show you how to reference a C++ class object for use in iOS projects.

In the following article, we will define a C++ class to use in the iOS OC environment, for convenience and straightforward we will show you in the form of pictures, and put on the Demo.

Knowledge in advance

H: header file. Header files contain declarations of classes, types, functions, and constants.

.m: source code file. This is a typical source file extension that can contain both Objective-C and C code.

.mm: source code file. Source files with this extension can contain C++ code in addition to Objective-C and C code. Use this extension only if you really need to use C++ classes or features in your Objective-C code

When you need to include header files in your source code, you can use the standard #include compilation option, but Objective-C provides a better way.

Specific steps