I have a Xcode project where I have to transfer Data from my SettingsViewController
to my ViewController
, the Problem is that I have to implement my SettingsViewController.h
in my ViewController
, because it gets pushed out of that - but to send data from the SettingsViewController
to ViewController
I have to implement the ViewController in SettingsViewcontroller
too thats when the Program gets stuck - it's not possible having a circular #import
reference, isn´t it?
Asked
Active
Viewed 1,389 times
1
1 Answers
4
Use forward declaration in all the .h files then and import the files in .m files
Check this question Objective-C: Forward Class Declaration
A forward declaration looks like this:
@class SettingsViewController;

Community
- 1
- 1

Mahmoud Fayez
- 3,398
- 2
- 19
- 36
-
Could you give me a code example for forward declaration please? – Maurice Oct 21 '12 at 02:23
-
2Also make sure that both object don't have strong (retain) pointers to each other, creating what is called a "retain cycle". – Kaan Dedeoglu Nov 08 '12 at 22:22