I am working on swift project where I need to use my old Objective-C
code.
I did managed to create -Bridge-Header.h
file and it works for me.
now in my Objective-C
code I need to refer UIWindow
from AppDelegate.swift
,
Can any one has done this before?
Please guide me!
First to access the Swift classes in ObjC ,you could import the compiler generated header file to expose those files to ObjC. It would be like ProductModuleName-Swift.h
.(This file doesn't really exists to see,but Xcode will automatically create it for you)
#import "YourProductName-Swift.h"
Then you can access the window
property in the app delegate from the ObjC file like
AppDelegate *delegate = [[UIApplication sharedApplication]delegate];
UIWindow *window = delegate.window;
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