This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @State var action: Bool = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct OpeningView : View { | |
| @State var action: Bool = false | |
| var body: some View { | |
| NavigationView { | |
| HStack { | |
| NavigationLink(destination: NewView(), isActive: $action) { | |
| EmptyView() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let model = try VNCoreMLModel(for: CatDogClassifier().model) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let request = VNCoreMLRequest(model: model) { (request, error) in | |
| self.processClassifications(for: request, error: error) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func processClassifications(for request: VNRequest, error: Error?) { | |
| DispatchQueue.main.async { | |
| guard let results = request.results else { | |
| return | |
| } | |
| let classifications = results as! [VNClassificationObservation] | |
| if classifications.first!.confidence > 0.9 { | |
| print("> 0.9 confidence that request is a \(classifications.first!.identifier)") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.imagePicker = UIImagePickerController() | |
| // Use the camera as the source | |
| imagePicker.source = .camera | |
| // Need to specify the delegate to get the result | |
| imagePicker.delegate = self | |
| // Present the imagePicker | |
| present(imagePicker, animated: true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { | |
| self.imagePicker.dismiss(animated: true) | |
| guard let image = info[.editedImage] as? UIImage else { | |
| print("No image found.") | |
| return | |
| } | |
| // At this point we know we have an image. | |
| // Print out the scale and size as a test: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var body: some View { | |
| ImagePicker() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun logIn(email: String, password: String) { | |
| mAuth.signInWithEmailAndPassword(email, password) | |
| .addOnCompleteListener(this, OnCompleteListener { task -> | |
| if (task.isSuccessful) { | |
| observer.logInSuccess(email, password) | |
| } else { | |
| observer.logInFailure(task.exception, email, password) | |
| } | |
| }) | |
| } |
OlderNewer