Posts

Post not yet marked as solved
2 Replies
0 Views
Here is my code: Here is my code: @Binding var workouts: [Workout] @State private var showWorkoutStudioEditor = false @State private var sortedBy: SortBy = .nameAscending      @Environment(\.scenePhase) private var scenePhase let saveAction: () -> Void var body: some View {         NavigationView {             ScrollView(showsIndicators: true) {                 ForEach($workouts, id: \.id) { workout in                     if !(sortedBy == .favorites) || workout.isFavorite.wrappedValue {                         WorkoutCard(                             workout: workout,                             workouts: $workouts,                             removeWorkout: removeWorkout                         )                             .padding([.leading, .trailing])                     }                 } } }
Post not yet marked as solved
3 Replies
0 Views
I did, but how would I get persistence with environment object? The way I am doing it, is it correct? Thank you!
Post not yet marked as solved
3 Replies
0 Views
I know where it happens and how to make it happen. But I don’t get any error message that takes me to specific line of code or view. How would you try to solve it?
Post marked as solved
1 Replies
0 Views
Hello everybody, This is the solution I found: The best way is to resize the image bellow 90%. Here is the code I used. I found it on StackOverflow. - https://stackoverflow.com/questions/29137488/how-do-i-resize-the-uiimage-to-reduce-upload-image-size extension UIImage { 		func resized(withPercentage percentage: CGFloat, isOpaque: Bool = true) -> UIImage? { 				let canvas = CGSize(width: size.width * percentage, height: size.height * percentage) 				let format = imageRendererFormat 				format.opaque = isOpaque 				return UIGraphicsImageRenderer(size: canvas, format: format).image { 						_ in draw(in: CGRect(origin: .zero, size: canvas)) 				} 		} 		func resized(toWidth width: CGFloat, isOpaque: Bool = true) -> UIImage? { 				let canvas = CGSize(width: width, height: CGFloat(ceil(width/size.width * size.height))) 				let format = imageRendererFormat 				format.opaque = isOpaque 				return UIGraphicsImageRenderer(size: canvas, format: format).image { 						_ in draw(in: CGRect(origin: .zero, size: canvas)) 				} 		} }
Post not yet marked as solved
3 Replies
0 Views
I did not I’ve to fix anything. The problem is with the simulator. It does not make a distinction between the photos you selected and those you have not. Try running on your device.
Post not yet marked as solved
3 Replies
0 Views
I am having exactly the same problem. Have you been able to solve it? Thank you!
Post marked as solved
3 Replies
0 Views
Thank you for your reply! Where should I initialise User Default values when the app is opened for the very first time? In the App Delegate file?
Post not yet marked as solved
3 Replies
0 Views
Hello, Thank you for your help. But I don't know what "CICAgICAwPmveRIJQWdsYWlzX2lv" corresponds to. I am dealing with more than 100 different labels and the object of study is very peculiar. I am identifying different species of butterflies. The Google Cloud platform gives a dict.txt file. This is the content of my CoreML file. Do you see anything that I could change? // // AutoML.swift // // This file was automatically generated and should not be edited. // import CoreML /// Model Prediction Input Type @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) class AutoMLInput : MLFeatureProvider {     /// image__0 as color (kCVPixelFormatType_32BGRA) image buffer, 224 pixels wide by 224 pixels high     var image__0: CVPixelBuffer     var featureNames: Set<String> {         get {             return ["image__0"]         }     }          func featureValue(for featureName: String) -> MLFeatureValue? {         if (featureName == "image__0") {             return MLFeatureValue(pixelBuffer: image__0)         }         return nil     }          init(image__0: CVPixelBuffer) {         self.image0 = image0     } } /// Model Prediction Output Type @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) class AutoMLOutput : MLFeatureProvider {     /// Source provided by CoreML     private let provider : MLFeatureProvider     /// scores__0 as dictionary of strings to doubles     lazy var scores__0: [String : Double] = {         [unowned self] in return self.provider.featureValue(for: "scores__0")!.dictionaryValue as! [String : Double]     }()     /// classLabel as string value     lazy var classLabel: String = {         [unowned self] in return self.provider.featureValue(for: "classLabel")!.stringValue     }()     var featureNames: Set<String> {         return self.provider.featureNames     }          func featureValue(for featureName: String) -> MLFeatureValue? {         return self.provider.featureValue(for: featureName)     }     init(scores__0: [String : Double], classLabel: String) {         self.provider = try! MLDictionaryFeatureProvider(dictionary: ["scores0" : MLFeatureValue(dictionary: scores0 as [AnyHashable : NSNumber]), "classLabel" : MLFeatureValue(string: classLabel)])     }     init(features: MLFeatureProvider) {         self.provider = features     } } /// Class for model loading and prediction @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) class AutoML {     var model: MLModel /// URL of model assuming it was installed in the same bundle as this class     class var urlOfModelInThisBundle : URL {         let bundle = Bundle(for: AutoML.self)         return bundle.url(forResource: "AutoML", withExtension:"mlmodelc")!     }     /**         Construct a model with explicit path to mlmodelc file         - parameters:            - url: the file url of the model            - throws: an NSError object that describes the problem     */     init(contentsOf url: URL) throws {         self.model = try MLModel(contentsOf: url)     }     /// Construct a model that automatically loads the model from the app's bundle     convenience init() {         try! self.init(contentsOf: type(of:self).urlOfModelInThisBundle)     }     /**         Construct a model with configuration         - parameters:            - configuration: the desired model configuration            - throws: an NSError object that describes the problem     */     @available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)     convenience init(configuration: MLModelConfiguration) throws {         try self.init(contentsOf: type(of:self).urlOfModelInThisBundle, configuration: configuration)     }     /**         Construct a model with explicit path to mlmodelc file and configuration         - parameters:            - url: the file url of the model            - configuration: the desired model configuration            - throws: an NSError object that describes the problem     */     @available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)     init(contentsOf url: URL, configuration: MLModelConfiguration) throws {         self.model = try MLModel(contentsOf: url, configuration: configuration)     }     /**         Make a prediction using the structured interface         - parameters:            - input: the input to the prediction as AutoMLInput         - throws: an NSError object that describes the problem         - returns: the result of the prediction as AutoMLOutput     */     func prediction(input: AutoMLInput) throws -> AutoMLOutput {         return try self.prediction(input: input, options: MLPredictionOptions())     }     /**         Make a prediction using the structured interface         - parameters:            - input: the input to the prediction as AutoMLInput            - options: prediction options          - throws: an NSError object that describes the problem         - returns: the result of the prediction as AutoMLOutput     */     func prediction(input: AutoMLInput, options: MLPredictionOptions) throws -> AutoMLOutput {         let outFeatures = try model.prediction(from: input, options:options)         return AutoMLOutput(features: outFeatures)     }     /**         Make a prediction using the convenience interface         - parameters:             - image__0 as color (kCVPixelFormatType_32BGRA) image buffer, 224 pixels wide by 224 pixels high         - throws: an NSError object that describes the problem         - returns: the result of the prediction as AutoMLOutput     */     func prediction(image__0: CVPixelBuffer) throws -> AutoMLOutput {         let input_ = AutoMLInput(image0: image0)         return try self.prediction(input: input_)     }     /**         Make a batch prediction using the structured interface         - parameters:            - inputs: the inputs to the prediction as [AutoMLInput]            - options: prediction options          - throws: an NSError object that describes the problem         - returns: the result of the prediction as [AutoMLOutput]     */     @available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)     func predictions(inputs: [AutoMLInput], options: MLPredictionOptions = MLPredictionOptions()) throws -> [AutoMLOutput] {         let batchIn = MLArrayBatchProvider(array: inputs)         let batchOut = try model.predictions(from: batchIn, options: options)         var results : [AutoMLOutput] = []         results.reserveCapacity(inputs.count)         for i in 0..<batchOut.count {             let outProvider = batchOut.features(at: i)             let result =  AutoMLOutput(features: outProvider)             results.append(result)         }         return results     } } Thank you!
Post marked as solved
2 Replies
0 Views
OMG! 😟 Thanks a lot! How didn't I realize that?Thank you!
Post not yet marked as solved
9 Replies
0 Views
I have https://...
Post not yet marked as solved
9 Replies
0 Views
This is the link: https://www.imgur.com/a/tyS0Q5u
Post not yet marked as solved
9 Replies
0 Views
This happens in the middle of the animation... And, as a result it just stays there. It just happens with one ballon.Here is a video of it happening:https://imgur.com/a/tyS0Q5u
Post not yet marked as solved
9 Replies
0 Views
It is always the same thing. i have one reply to this post being moderated where I provide a vídeo.Image the ballons floating from bottom to top. In the middle of the animation one ballon appears on the top left corner and stays there fixed... It always happens the same way.
Post not yet marked as solved
9 Replies
0 Views
This happens in the middle of the animation... And, as a result it just stays there. It just happens with one ballon.
Post not yet marked as solved
4 Replies
0 Views
Hello!I tried an using global() crashes the playground...With main it works.