에 대한 정의되지 심볼 : 오류가Coda2 플러그인에 Obj C 헤더가있는 Swift를 사용하려고합니다. swift.I'm이 오류가와 코다 2.5 플러그인을 구축을 위해 노력 아키텍처 x86_64의
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_CodaPlugInsController", referenced from:
_get_field_types_PowPlugInViewController in PowPlugInViewController.o
_get_field_types_PowPlugIn in PowPlugin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
내 빌드 폴더를 청소했다. 프로젝트 이름 -bridging-swift.h에 가져 오기 문을 생성하고 추가했습니다.
다음은 내 프로젝트입니다.
CodaPlugInsController.h
현재이 파일을 찾을 수 있습니다. https://github.com/panicinc/CodaPluginKit/tree/master/Cocoa%20Plug-ins Discription : 이 헤더는 Coda 텍스트 기반 구문 유효성 검사기 및 사이드 바 플러그인을 구현하는 데 필요한 프로토콜과 기능을 제공합니다.
CodaPow 브리징-header.h가
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "CodaPlugInsController.h"
PowPlugin.swift
import Foundation
class PowPlugIn: NSObject, CodaPlugIn, CodaSidebarPlugIn {
let PowBundle: CodaPlugInBundle
let PowController: CodaPlugInsController
required init(plugInController: CodaPlugInsController, plugInBundle: CodaPlugInBundle) {
self.PowBundle = plugInBundle
self.PowController = plugInController
super.init()
}
func name() -> String {
return "Coda Pow"
}
func didLoadSiteNamed(name: String!) {
}
func viewController() -> NSViewController {
return PowPlugInViewController(nibName: "PowPlugInView", plugInBundle: PowBundle, plugInController: PowController)!
}
}
PowPlugInViewController.swift
import Foundation
class PowPlugInViewController: NSViewController, CodaSidebarViewController {
let PowController: CodaPlugInsController
init?(nibName: String, plugInBundle: AnyObject, plugInController: CodaPlugInsController) {
self.PowController = plugInController
super.init(nibName: nibName, bundle: plugInBundle as? NSBundle)
}
// Xcode Says I need this.
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
두 개의 소스 파일이 더 있습니다. ServerAndHosts.swift 및 Shell.swift는 그들은 CodaPlugInsController.h의 클래스 중 하나를 사용하지 마십시오. Shell.swift 파일은 클래스 함수 집합입니다.
편집 : 나는 CodaPlugInsController.h에서 서브 클래스 나 된 개체에 전달하지 않는 내가 한 신속 사용할 수 있습니다.
스위프트와의 Obj-C 프로젝트의 버전 :이 https://www.dropbox.com/sh/bsw8cinn7kp9kfe/AAAgG_B44dbHNP5-JwJ3Amf8a?dl=0