如何在iOS中使用Swift中的iosMath,因爲iosMath是用Objective C編寫的?或者有另一種方法來顯示數學公式與斯威夫特?在Swift中使用iosMath
0
A
回答
0
我必使這儘可能快:
1)安裝的CocoaPods(打開終端,寫sudo gem install cocoapods
)
2)從終端改變目錄到你的項目和init的CocoaPods和編輯podfile這樣的:
cd /ProjectFolder
pod init
nano podFile
(打開podfile,在那裏你粘貼莢回購),應該是這樣的:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'mathExample' do
# Comment the next line if you're not using Swift and don't want to use dynam$
use_frameworks!
# Pods for mathExample
pod 'iosMath'
end
保存podfile,並通過安裝:
pod install
從現在開始,使用工作區文件,而不是項目文件。我們完成安裝,你需要對現在的莢...
現在有點棘手 - >您需要從項目中添加新的Objective-C文件(所以只需新建文件 - > Objective-C文件並選擇創建橋接頭),您可以刪除創建的文件(但不是BRIDGING HEADER)
從現在起,您可以像使用快速fr一樣使用Objective-C框架不要忘了將該框架導入你將要使用它的類:
import UIKit
//Importing our module
import iosMath
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print(iosMathVersionNumber)
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
希望這有助於,希望快樂的編碼! :)
0
一般問題已經回答。 Check this question out。
您只需在podfile中添加iosMath
,只要您在podfile中有use_frameworks!
,就不需要任何標題。簡單地說,在你的swift文件中導入iosMath
,你很好。
相關問題
- 1. 在Swift 2.3中使用Swift 3框架
- 2. 使用swift在IOS下使用swift在xcode中實現Bump Distortion
- 3. 在swift中使用AFHTTPSessionManager
- 4. 在Swift 1.2中使用assetForURL
- 5. 在Swift中使用RestKit
- 6. 在Swift中使用標籤
- 7. 在swift中使用.viewControllers
- 8. 在swift中使用C++ DLL
- 9. 在Swift 2.0中使用NSFetchedResultsController
- 10. 在Swift中使用LSApplicationWorkspace
- 11. 在Swift中使用edgeLoopFromRect
- 12. 在Swift中使用框架
- 13. 在swift中使用widevine庫
- 14. 在swift中使用塊
- 15. 在Swift 2.0中使用mogenerator
- 16. 在Swift中使用數組
- 17. iAd在SpriteKit中使用Swift
- 18. 在Swift中使用NSMutableArray sortUsingFunction?
- 19. 在swift中追加使用
- 20. 在Swift 2中使用TouchesMoved
- 21. 在Swift中使用extern「C」?
- 22. 使用swift在ViewController中使用UIView
- 23. 使用Swift在TableView中迭代UITextViews使用Swift
- 24. 在Swift中使用對CFPropertyListRef的引用
- 25. 在Swift中使用UITableViewCell調用對象
- 26. 在Swift項目中同時使用Swift代碼中使用Objective-C代碼
- 27. 在swift中使用交叉類變量
- 28. 如何在Swift中使用位操作?
- 29. 在CoreData中使用Swift日期
- 30. 你如何在Swift中使用CGEventTapCreate?
你讀過[如何從Swift調用Objective-C代碼](https://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift)? –