Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to use SWRevealViewController and Swift?

What is the right way to use SWRevealViewController with Swift? XCode: 6.0.1 I am even having trouble important the file properly :/

enter image description here

MenuViewController.swift

import UIKit
import SWRevealViewController

class MenuViewController: SWRevealViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

If someone has a small github they could point me to I would really appreciate it!

like image 588
AG1 Avatar asked Dec 07 '25 19:12

AG1


1 Answers

In order to access your Objective C classes from your Swift code, you'll need a bridging header. Apple has a good explanation here:

Swift and Objective-C in the Same Project

Once you have the bridging header:

  1. add #import "SWRevealViewController.h" to the bridging header file
  2. there is no step 2, your class is now available to all your swift code in that target.
  3. profit?
like image 59
Lance Avatar answered Dec 10 '25 10:12

Lance



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!