I am having trouble getting iosMath to work.
Can anyone tell me what I may have missed? Here is what I have done:
I followed the instructions on https://cocoapods.org/pods/iosMath (having never used cocoapods until now, there is much left out for us newcomers!).
First I had an issue just installing the podfile but finally got that done with the following (I got pages of error messages until I used Rosetta - I maybe because I have an M1 processor?):
- Close Terminal
- in Applications, right-click on Terminal, select "Get Info", then click "Open using Rosetta":
- close the window
- reopen Terminal
- enter:
sudo gem uninstall ffi
- enter:
sudo gem install ffi
Finally installing the podfile was successful:
- In Terminal, enter:
pod install
This is the podfile:
platform :ios, '12.1'
target 'MyApp' do
pod 'iosMath', '~> 0.9'
end
At this point, I expected this example (from https://stackoverflow.com/a/63639192/8635708) to work:
import UIKit
import CoreGraphics
import QuartzCore
import CoreText
import iosMath
class iosMathTest: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let label: MTMathUILabel = MTMathUILabel()
label.latex = "x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}"
//ADD THIS LABE TO THE VIEW HEIRARCHY
view.addSubview(label)
// need to call sizeToFit() to get it to calculate the frame
label.sizeToFit()
// center it in the view
label.center = view.center
// so we can see the frame
label.backgroundColor = .yellow
}
However, on the import iosMath
line, I get the error message: No such module 'iosMath'
. I've tried opening both MyApp.xcworkspace and MyApp.xcodeproj but both give me the same error.
What else do I need to do?
question from:https://stackoverflow.com/questions/66055711/trouble-installing-iosmath