NSDictionary *detectorOptions = [[NSDictionary alloc] initWithObjectsAndKeys:CIDetectorAccuracyLow, CIDetectorAccuracy, nil];
self.faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:detectorOptions];
请帮我把它转换成swift。
我从iCapps中引用了这段代码。 我只学过斯威夫特。我试图低估代码,但有点混乱。 如果有专家知道,请帮助我。并建议我将Obj-C轻松转换为Swift的一些想法。
答案 0 :(得分:0)
let detectorOptions = [CIDetectorAccuracy: CIDetectorAccuracyLow]
self.faceDetector = CIDetector(ofType: CIDetectorTypeFace, context: nil, options: detectorOptions)
答案 1 :(得分:0)
Swift Code:
var detectorOptions: [NSObject : AnyObject] = [
CIDetectorAccuracy : CIDetectorAccuracyLow
]
self.faceDetector = CIDetector.detectorOfType(CIDetectorTypeFace, context: nil, options: detectorOptions)
答案 2 :(得分:0)
我已经为您转换了它,但是如果您不了解swift,现在可以使用此网站https://objectivec2swift.com进行转换
<input type="text" placeholder="Enter" class="form-control" name="Emp" ng-model="myModel.Emp" ng-required="currentStep ==2"/>
<input type="text" placeholder="Enter" class="form-control" name="EmpS" ng-model="myModel.EmpS" ng-required="currentStep == 2"/>
<span ng-if="(emp.indexOf('{{myModel.Emp}}') > -1 ) ? (myModel.EmpS=''):(myModel.EmpS=emp.indexOf('{{myModel.Emp}}'))" ></span>