Skip to content

Instantly share code, notes, and snippets.

View gali8's full-sized avatar

Daniele - mokapp.com gali8

View GitHub Profile
//
// AppDelegate.m
// Gap
//
// Created by Daniele on 02/04/13.
// Copyright (c) 2013 Daniele Galiotto - www.nexor.it. All rights reserved.
//
#import "AppDelegate.h"
@gali8
gali8 / XCode10TesseractFix
Last active August 23, 2019 10:41
libstdc++ is removed in iOS 12 simulator but it remains in the iOS 12.0 (device)
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'TesseractOCRiOS'
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
header_phase = target.build_phases().select do |phase|
phase.is_a? Xcodeproj::Project::PBXHeadersBuildPhase
end.first
@gali8
gali8 / ConfaloGenerics.swift
Last active February 15, 2018 09:45
ConfaloGenerics
//: Playground - noun: a place where people can play
import UIKit
class PFObject: Any {
}
let objsA: [PFObject] = []
let objsB: [[String: Any]] = [[:]]
#to print Build settings type on terminal: xcodebuild -project MyProject.xcodeproj -target "MyTarget" -showBuildSettings
#PROJECT_DIR = /Users/daniele/Desktop/MyProjectFolder
project_content_folder="MyProject"
storyboard_file="Main.storyboard"
storyboard_file_orig="Main_orig.storyboard"
storyboard_file_backup="Main_bk.storyboard"
storyboard_dir="${PROJECT_DIR}/${project_content_folder}/Base.lproj"
#to print Build settings type on terminal: xcodebuild -project MyProject.xcodeproj -target "MyTarget" -showBuildSettings
#PROJECT_DIR = /Users/daniele/Desktop/MyProjectFolder
project_content_folder="MyProject"
storyboard_file="Main.storyboard"
storyboard_file_orig="Main_orig.storyboard"
storyboard_file_backup="Main_bk.storyboard"
storyboard_dir="${PROJECT_DIR}/${project_content_folder}/Base.lproj"
rm -frd ~/Library/Developer/Xcode/DerivedData/*
rm -frd ~/Library/Caches/com.apple.dt.Xcode/*
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina5_9" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
func resetOnError() {
DispatchQueue.main.async {
self.imgPicture?.image = nil
self.lblGender?.text = self.noPixels
}
}
func setGender(prob: MLMultiArray?) {
DispatchQueue.main.async {
guard let probArray = prob, probArray.count >= 2 else {
func predictImageVision(image: UIImage) {
let genderModel = try! VNCoreMLModel(for: Gender().model)
let genderRequest = VNCoreMLRequest(model: genderModel) { (req, err) in
guard let results = req.results as? [VNCoreMLFeatureValueObservation], let firstResult = results.first else {
self.resetOnError()
return
}
self.setGender(prob: firstResult.featureValue.multiArrayValue)
}