Boxed NSObjects fail for Cocoapods installation
kylealanhale opened this issue · comments
When installing the framework via Cocoapods, NSObject subclasses aren't properly boxed, due to the compiler conditional in Box.swift.
Here's a temporary workaround hook for a project's Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "GRMustache.swift"
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)', '-DOBJC']
end
end
end
end
@kylealanhale Thank you for the notice, let me have a look.
Damned, I forgot this issue for the 2.0.0 release.
@kylealanhale, @AMTourky Do you know what is needed in the podspec for the OBJC
swift flag to be automatically set?
Currently having this issue... Thought I'd have to manually override for boxed items! Any update on this?
@groue @sahandnayebaziz It's been a while, but I'm not sure that it was a problem with the podspec; if so, maybe the modification I made to my podfile in the original report will be helpful. But if I'm remembering correctly, it would be better to remove the OBJC
check and handle that scenario differently. (Also, it looks like the code in question was moved during the 2.0.0 refactor; it's now here.)
I've lost some hours debugging this when switching from the ObjC version GRMustache to GRMustache.swift for rendering of my NSObject, so I propose at least adding a note to the README with #71.
Same problem also happens when using as Swift package, probably not fixable because in a Swift package it's not possible to have Obj-C source files.
But maybe GRMustacheKeyAccess
could be rewritten in Swift now? At least the problematic example in the implementation note from here now works in Swift:
GRMustache.swift/ObjC/GRMustacheKeyAccess.h
Lines 25 to 51 in 7befd1a
Unfortunately I'm not able to do it ATM.