2016-04-15 3 views
1

iOS Affdex SDKをブリッジヘッダーとともに使用しようとしています(Swiftで)。このプロセスについてどうやって行くのか教えてください。また、SDKに基づいてemojisを表示する方法もあります(Swiftを使用したagin)。ここでAffiftx SDKをSwiftで使用するには?

答えて

4

はスウィフトの命名規則にObjective-Cののお手伝いをするためにいくつかのリンクです:

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html

私はスウィフトで私たちのSDKを使用する方法を示し、単純なビューコントローラクラスを添付しました。うまくいけば、これはあなたを助けるでしょう。

class ViewController: UIViewController, AFDXDetectorDelegate { 

    var detector : AFDXDetector? = nil 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     // create the detector 
     detector = AFDXDetector(delegate:self, usingCamera:AFDX_CAMERA_FRONT, maximumFaces:1) 
     detector?.setDetectEmojis(true) 
     detector!.start() 
    } 

    func detectorDidStartDetectingFace(face : AFDXFace) { 
     // handle new face 
    } 

    func detectorDidStopDetectingFace(face : AFDXFace) { 
     // handle loss of existing face 
    } 

    func detector(detector : AFDXDetector, hasResults : NSMutableDictionary?, forImage : UIImage, atTime : NSTimeInterval) { 
     // handle processed and unprocessed images here 
     if hasResults != nil { 
      // handle processed image in this block of code 

      // enumrate the dictionary of faces 
      for (_, face) in hasResults! { 
       // for each face, get the rage score and print it 
       let emoji : AFDXEmoji = face.emojis 
       let rageScore = emoji.rage 
       print(rageScore) 
      }     
     } else { 
      // handle unprocessed image in this block of code 
     } 
    } 
+0

'公共のinit!(デリゲート:AFDXDetectorDelegate!カメラを使用して:AFDXCameraType、maximumFaces:UINT)'スウィフト3、いずれかの選択肢のようdeperecatedされますか? –

関連する問題