Add @import UIKit; or @import Cocoa; for generated main.m

parent ae13ab00
...@@ -421,7 +421,12 @@ module Pod ...@@ -421,7 +421,12 @@ module Pod
'' ''
end end
end end
source_file.open('w') { |f| f << "@import Foundation;\n#{import_statement}int main() {}\n" } source_file.open('w') do |f|
f << "@import Foundation;\n"
f << "@import UIKit;\n" if consumer.platform_name == :ios || consumer.platform_name == :tvos
f << "@import Cocoa;\n" if consumer.platform_name == :osx
f << "#{import_statement}int main() {}\n"
end
end end
source_file source_file
end end
......
...@@ -524,6 +524,7 @@ module Pod ...@@ -524,6 +524,7 @@ module Pod
file.basename.to_s.should == 'main.m' file.basename.to_s.should == 'main.m'
file.read.should == <<-OBJC.strip_heredoc file.read.should == <<-OBJC.strip_heredoc
@import Foundation; @import Foundation;
@import UIKit;
@import ModuleName; @import ModuleName;
int main() {} int main() {}
OBJC OBJC
...@@ -547,6 +548,7 @@ module Pod ...@@ -547,6 +548,7 @@ module Pod
file.basename.to_s.should == 'main.m' file.basename.to_s.should == 'main.m'
file.read.should == <<-OBJC.strip_heredoc file.read.should == <<-OBJC.strip_heredoc
@import Foundation; @import Foundation;
@import UIKit;
#import <ModuleName/ModuleName.h> #import <ModuleName/ModuleName.h>
int main() {} int main() {}
OBJC OBJC
...@@ -559,6 +561,7 @@ module Pod ...@@ -559,6 +561,7 @@ module Pod
file.basename.to_s.should == 'main.m' file.basename.to_s.should == 'main.m'
file.read.should == <<-OBJC.strip_heredoc file.read.should == <<-OBJC.strip_heredoc
@import Foundation; @import Foundation;
@import UIKit;
int main() {} int main() {}
OBJC OBJC
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment