No prior knowledge for using external library in Swift.
I was trying to include sf-proj-ios in my empty project named "Test". I followed instruction on the library GitHub, used commands on MacOS terminal.app:
(installed CocoaPods)
brew install automakebrew install libtoolcd /Users/MYNAME/Documents/Testpod init
Podfile in project folder:
platform :ios, '15.0'
target 'Test' do
pod 'sf-proj-ios', '~> 6.0.3'
use_frameworks!
target 'TestTests' do
inherit! :search_paths
end
target 'TestUITests' do
end
end
pod install
Notes: I did not make any changes to the bridging header build settings as I don't really understand where to import it as stated in the GitHub guide. i.e. where to put the line:
#import "sf-proj-ios-Bridging-Header.h"
Tried to add sf-proj-ios-Bridging-Header.h in Objective-C Bridging Header in project Build Settings but error prevailed.
- Opened Test.xcworkspace with Xcode and added
test()function to ViewController
import UIKit
import proj_ios
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
test()
}
func test(){
let projection1: PROJProjection = PROJProjectionFactory.projection(withAuthority: PROJ_AUTHORITY_EPSG, andIntCode: PROJ_EPSG_WEB_MERCATOR)
}
}
- Built and ran Test, resulted in error
Use of undeclared identifier 'nullptr'and'crs.hpp' file not found with <angled> include; use "quotes" insteadoccurred at library fileoptargpm.handproj.cpp.
Tried to fix the "angled" with "quotes" as suggested by the compiler but it did not help.
Tried comment and uncomment
use_frameworks!in the podfile then re-install pod but also not helping.Searched online and found out that
nullptris available after C++11. Checked Build Settings of the project but all Clang dialects are 17 or above.
Suspected that the problem was due to improper installation of the library. Please advice how should it be done correctly.
Project environment:
Mac Mini with M2 Chip
macOS: 14.0 (23A344)
Xcode: Version 15.4 (15F31d)
Attached project Test.zip


nullptris from C++. you need import it's headers inside#ifdef _cplusplus #endifblock