Swifty range operator and CIDetector power

Swifty range operator and CIDetector power

Presented during the #PotatoTips 54 at Eureka Inc office, Tokyo.

7ae6754dde29da348e2ac6d6bca07958?s=128

Rebouh Aymen

August 23, 2018
Tweet

Transcript

  1. POTATOTIPS
 #54

  2. Self ! Aymen Rebouh from France iOS Engineer at Eureka

    Inc Twitter/Github: @aymenworks
  3. @aymenworks

  4. • Swift 4.2 and ~= operator • CoreImage and CIDetector

    Self
  5. One question..

  6. One question.. How many of you know the ~= operator

    ?
  7. ~= operator Check if an array of ೥ྸ contains only

    value between 18 and 25 Before let usersAges = [18, 22, 20, 32] var agesConform = true for age in agesConform {
 if age >= 18 && age <= 25 {
 agesConform = false return } }
 // false After let usersAges = [18, 22, 20, 32]
 usersAges.filter { age >= 18 && age <= 25 }.count == usersAges.count
 // false After #2 let usersAges = [18, 22, 20, 32]
 usersAges.allSatisfy { 18...25 ~= $0 }
 // false
  8. Did someone already used Core Image?

  9. CoreImage - CIDetector ͳʹ͜Εʁ

  10. CoreImage - CIDetector How it works Rectangles, QRCode, Text Smile

    ☹, Eye blink CIDetector: Image Processor object Faces
  11. CoreImage - CIDetector Smile detection

  12. CoreImage - CIDetector Smile detection

  13. CoreImage - CIDetector Smile detection #1 CIDetector let detector =

    CIDetector( ofType: CIDetectorTypeFace, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh] )! #2 Detecting Smile let faces = detector.features( in: CIImage(image: ), options: [CIDetectorSmile: true]) as? [CIFaceFeature] Do what you want For face in faces { // face.bounds, face.hasSmile, face.mouthPosition, etc.. }
  14. CoreImage - CIDetector Smile detection

  15. CoreImage - CIDetector Smile detection

  16. CoreImage - CIDetector https://github.com/WeTransfer/WeScan

  17. Github - JSONShootout https://github.com/bwhiteley/JSONShootout

  18. None