Include non-modular header inside framework module with Allow non-modular includes set to YES
Asked Answered
C

1

10

Background
I'm building an API framework in Swift. I want it to include a Reachability class that can be used internally and externally.

Status
I've copied the source of the Reachability class provided by Tony Million, added the import statement to my header. The .h file is set to public in the Headers section of Build Phases. I've set Allow Non-modular Includes in Framework Modules to YES in both my project and target. Whenever I go to build the project, I get the error:

Include of non-modular header inside framework module 'MyFramework.Reachability'

on the line that imports ifaddrs.h.

Question
How can I get my project to build? Is there another framework I need to link against that isn't SystemConfiguration?

Commotion answered 14/11, 2014 at 17:29 Comment(3)
Nope, I just trashed the idea.Commotion
Same here, I could not get it to work either.Sundry
Are you still having this issue? If yes, can you provide an example project that demonstrates it? I tried to replicate but I didn't succeed (it's working for me).Ethiopia
E
0

Have a look at this sample project: https://github.com/tomaskraina/swift-modules-reachability

It consists of a ApiFramework and a ReachabilityApp and demonstrates how to set it up so you can use Reachability both internally in the framework as well as externally - in the app.

Xcode workspace screenshot

Ethiopia answered 23/4, 2015 at 23:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.