2017-07-18 30 views
0
# Uncomment the next line to define a global platform for your project 
# platform :ios, '9.0' 

target 'ytl' do 
    # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 
    # use_frameworks! 

    # Pods for ytl 

    pod 'Google-Mobile-Ads-SDK', '~> 7.20’ 
    pod "AXWireButton" 
    pod "DGActivityIndicatorView" 
    pod use_frameworks! 「RaisePlaceholder」 
end 

創建斯威夫特RaisePlaceholder,現在我想在Objective-CUIView類進口。我如何導入迅速莢類爲目標C UIView類

如何將Swift pod類導入到Objective-C UIView類?

您的輸入將被處理。

+0

#進口不工作? –

+0

如果您不使用橋接頭,請使用它來導入 –

+0

這是哪個項目? Objective C項目還是Swift項目? –

回答

0

只需在您的斯威夫特上課前加@objc像下面

@objc class YourSwiftClass: UIViewController 

現在,在您的項目& targt設置,下面的標誌更改爲YES

定義模塊:是

總是嵌入Swift標準庫:是的

安裝Objective-C的兼容性部首:YES

現在清理項目COMMAND+K現在導入你的目標C文件像普通進口

#import "YourTargetName-Swift.h" 

注:如果你的目標名稱包含空格,更換他們與下劃線(例如:「示例項目」成爲「Sample_Project-Swift.h」)。還有一點要注意,其實,這是不是你的項目名稱,而不是你的目標

鏈接蘋果文檔How to use Swift code in Objective C