Original http://blog.csdn.net/xuanwenchao/article/details/30226823
1. We add the Swift class to the existing Objective-c project. Cmd+n is shown below
2. Click Next and enter Sfloginview language to select Swift
3. Click Next to pop up the causeway, whether to create a bridge file, only the first time the creation will appear, create a second class if you have previously created a hint, the file is used in Swift to use the Objective-c class, the introduction of the header file.
4. Click Yes to create two files, as shown, my project is called Sepass, the generated bridge file is called Sepass-bridging-header.h
5. Open the Sfloginview.swift file and create one of our swift classes, of course you can also use the playground file to edit and copy to the swift file.
6. Now suppose that we need to use a objective-c class in Swift, called GTMBase64, at which point we just open the bridged file we just generated sepass-bridging-header.h to reference the header file we want (#import "GTMBase64.h").
7. Once the header file is referenced, the class can be used directly.
var imagedata:nsdata = GTMBase64. Decodestring (G_dataimagekey)
8. Now that the class Sfloginview we have written with Swift has been completed, we are going to refer to our Swift-written class in the existing objective-c, because the Swift class has no header files, and we cannot import them directly. So we're going to help him. Generate a header file that can be referenced, point to project file, and select Targets-buildingsettings, Product Module Name we enter Whatwhatwhat
9. At this point, Xcode generates a header file, whatwhatwhat-swift.h we can use the Sfloginview class only after we reference it in the oc.m file that we want to use Sfloginview.
#import "Whatwhatwhat-swift.h"
10. Let's see what's in the whatwhatwhat-swift.h.
It appears that the system helped us to generate a class implementation of the objective-c that corresponds to the Swift class
11. The following is an official note, once you import the SWIFT code into your project, you can use the standard ocjective-c to operate the Swift class
Objective-c works with Swift