I am using XCode 8 + Swift 3.
I created a fresh iOS project named "MyApp". Then, I create a Cocoa touch framework project, named "MySubProject". (The idea is to have MyApp project accessing MySubProject code.)
They are on the same level folder:
- MyApp/
- MySubProject/
In MySubProject, I have a MyService.swift
file (it is MyService
class) under service group/folder:
The code is very simple:
import Foundation
public class MyService {
public func greeting() -> String {
return "Hello my service!"
}
}
In MyApp, I added MySubProject.xcproject
into MyApp project as a sub-project under MyApp:
Then, I drag and dropped the MySubProject.framework under MySubProject/Products/
into MyApp project's General --> Embedded Binaries and Linked Framework and Libraries:
Now, under MyApp/ViewController.swift
, I import the MyService
class from MySubProject
:
But when I build MyApp project, I always get compiler error "No such module 'MyService'" as you see in above picture.
Why? How to make MyApp being able to access MySubProject code?
import MySubProject ! not myService...after that copy framework to the app, see the snapshot, please. I can't post image. snapshot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With