Closed sabirvirtuoso closed 6 years ago
In Swift 3 this is next function: /**
Thanks. I was just curious to know how the objective C header is bridged to Swift as it seems almost impossible for me to guess how it converts the above static function in Objective C to an optional initializer.
Regards.
the function is not exported to swift (4.2):
+ (nullable MBProgressHUD *)HUDForView:(UIView *)view;
If renamed to i.e. "findHUDForView" it is accessible from swift by:
MBProgressHUD.find(for: myViewParam)
Instead of renaming you can add the following (new line!) after the definition in the header file:
+ (nullable MBProgressHUD *)HUDForView:(UIView *)view
NS_SWIFT_NAME(find(for:));
With this "annotation" the method can be called from swift 4.2 with:
MBProgressHUD.find(for: myViewParam)
As I said: HUDForView is not a constructor but a lookup method, that searches a HUD in all subviews. Please think about fixing this, as we still need this method.
Hi,
I found this Objective C API in MBProgressHUD.h but when I try to use it from Swift, the compiler throws an error. Any suggestions how I can access it from Swift or possible reasons why the API is not accessible from Swift.
Thanks