m1entus / MZFormSheetPresentationController

MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup UIPresentationController size and feel form sheet.
MIT License
974 stars 145 forks source link

Bridging header missing newline at EOF, breaking builds that require it #127

Closed zygoat closed 7 years ago

zygoat commented 7 years ago

Our project uses -Wnewline-eof (GCC_WARN_ABOUT_MISSING_NEWLINE) as a general practice. This is set at the project level. When MZFormSheetPresentationController is incorporated via CocoaPods 1.2.0, it fails to build, due to its Swift bridging header (MZFormSheetPresentationController Swift Example-Bridging-Header.h, an odd name) failing to end with a newline at end of file.

As far as I can tell, it is necessary to locally edit this file and insert the newline in order to let the project build. It seems unfortunate that even though our setting is outside the scope of the MZ project, it nonetheless has effect. (Maybe this is related to how Pods are built as modules nowadays?)

In years past I have run in to the same problem with other sources which I was able to work around by using a construct like:

    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wnewline-eof"
    #import <foo/bar.h>
    #pragma clang diagnostic pop

This has no effect when MZ is imported using an @import statement, however, and importing the old #import way yields an error “Definition of 'MZFormSheetPresentationViewController' must be imported from module 'MZFormSheetPresentationController.MZFormSheetPresentationViewController' before it is required”.

The simple fix is to merely insert the newline at the end of this file. I can open a PR if that's desired.

In the mean time, any workaround advice is welcome. I might have to add a shell script phase to fix the file…

m1entus commented 7 years ago

Please open PR, i would appreciate it, thanks!

zygoat commented 7 years ago

Done (#128). Thanks!