0

how can I use iosMath in Swift on iOS, because iosMath is written in Objective C? Or is there another way to display mathematical formulas with Swift?

1

2 Answers 2

2

I will make this as fast as possible:

1.) install cocoaPods (open up terminal and write sudo gem install cocoapods)

2.) From terminal change directory to your project and init cocoaPods and edit the Podfile like this:

cd /ProjectFolder
pod init
nano podFile 

(opens the podfile, where you paste the pod repo) , should look like this:

# 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

save podfile and install via:

pod install

from now, use the workspace file instead of the project file... We are done installing the pod you need right now...

Now it gets a little bit tricky -> You need to add new Objective-C file into the project (so just New File -> Objective-C file and select create bridging header) from now, you can just delete the created file (BUT NOT THE BRIDGING HEADER)

from now, you can use the Objective-C framework just as it was swift framework,don't forget to import that framework into classes you will use it:

    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.
    }


}

Hope this helps, wish happy coding! :)

Sign up to request clarification or add additional context in comments.

Comments

0

The general question has already been answered. Check this question out.

All you have to do is add iosMath in your podfile and as long as you have use_frameworks! in the podfile, you won't need any headers. Simply, import iosMath in your swift file and you are good to go.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.