[英]Using iosMath in Swift
我将尽可能快地做到这一点:
1.)安装cocoaPods(打开终端并编写sudo gem install cocoapods
)
2.)从终端更改目录到您的项目,然后初始化cocoaPods并编辑Podfile,如下所示:
cd /ProjectFolder
pod init
nano podFile
(打开podfile,在其中粘贴pod repo),应如下所示:
# 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
从现在开始,使用工作区文件而不是项目文件...现在,我们已经完成了您所需的Pod的安装...
现在有点棘手->从现在开始,您需要将新的Objective-C文件添加到项目中(因此只需新建文件-> Objective-C文件并选择创建桥接头),就可以删除已创建的文件(但不是桥接标题)
从现在开始,您可以像使用快速框架一样使用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.
}
}
希望对您有所帮助,祝编码愉快! :)
一般问题已经回答。 看看这个问题 。
您所要做的就是在您的podfile中添加iosMath
,只要您有use_frameworks!
在podfile中,您不需要任何标题。 只需将iosMath
导入您的swift文件中,就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.