Post

Replies

Boosts

Views

Activity

Reply to VStack adds a space when I have a ZStack with multiple items inside
The vertical spacing is set by the VStack. If the VStack's "spacing" is nil, then the stack will "choose a default distance for each pair of subviews". As you are seeing, this distance is not necessarily the same for every pair of views. It's not possible to specify the spacing within the VStack. The only way to enforce the VStack spacing of 0 is to use: VStack(alignment:.leading, spacing: 0) { ...which you can't do. So I think you are stuck.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Reply to Unexpected non-void return value in void function
In getData(), you "return dumm" within a closure which executes asynchronously. That is, it can execute after getData() has returned. So getData cannot return it's Double value there. The closure itself does not return a value (hence the error message). And since you only retrieve "dumm" within the closure, you cannot use getData's return value to return dumm. You should probably remove the return value from getData, and handle the closure's result somehow (e.g. by passing a completion closure to getData, which can then process "dumm"). By the way, it would be easier to help you if you could use (instead of your mass of code, and a screenshot) a Code Block for your code, and use "Paste and Match Style". Like this: //MARK : HealthStore func getData() -> Double { //Get Authorization let stepType = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)! let heartRate = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate)! let spo2 = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.respiratoryRate)! healthStore.requestAuthorization(toShare: [], read: [stepType,heartRate,spo2]) { (chk, error) in if (chk){ print("Permission Granted") var dumm = 0.0 //currentHeartRate(completion: nil) self.getSteps(currentDate: Date()) { result in globalString.todayStepsCount = result dumm = result print(result) } return dumm } } } //getData func getSteps(currentDate: Date, completion: @escaping (Double) -> Void) { guard let sampleType = HKCategoryType.quantityType(forIdentifier: .stepCount) else { print("Get Steps not executed as is null") return } let now = currentDate //Date() let startDate = Calendar.current.startOfDay(for: now) let predicate = HKQuery.predicateForSamples(withStart: startDate, end: now, options: .strictEndDate) let query = HKStatisticsQuery(quantityType: sampleType, quantitySamplePredicate: predicate, options: .cumulativeSum) { _, result, _ in guard let result = result, let sum = result.sumQuantity() else { completion(0.0) return } completion(sum.doubleValue(for: HKUnit.count())) } healthStore.execute(query) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Reply to Mac Mini M1 Hardware without case.
It's an interesting question! Apple will not sell you a Mac Mini without a case. I doubt anyone else would either: It's a very limited/specialist market They can't source such a product Your best option is to buy a Mac Mini, remove the innards, and recycle the case. That's all anyone else could do, and they would charge you extra for it. Perhaps when the "Self Service Repair" is more common, it will be easier/possible to source such components? https://www.apple.com/newsroom/2021/11/apple-announces-self-service-repair/
Topic: App & System Services SubTopic: Hardware Tags:
May ’22
Reply to Issue with split(or at least I think so)
You use: r = Int(key[0].split(",")[0]) * key[1] You could try breaking that line down into smaller components, to better understand why it doesn't work. For example: let x = key[0] No exact matches in call to subscript Oopsies! It's much easier to debug smaller statements. What you are calling "key" (bad name!) is actually a Dictionary<String, Double> So if you said: for dictionary in self { That would iterate through the dictionaries in your array... ...then you could action the values in the dictionary: for key in dictionary.keys {
Topic: Programming Languages SubTopic: Swift Tags:
May ’22
Reply to Expected declaration
You have added your last two lines as part of the class definition, which is an error. Try putting them in a method, like this: func test() { let myInfo = AboutMe(firstName: "NAME", lastName: "NAME", age: 10) print(myInfo) } Note: That will compile okay... But it will probably not print what you are expecting, as you have not conformed "AboutMe" to CustomStringConvertible, but that's a different question!
Topic: Business & Education SubTopic: General Tags:
Apr ’22
Reply to Working with Contractors
I'm very wary of {sharing my apple dev credentials} Rightly so! Is your Apple Developer account as an Individual or an Organization? "Individual" accounts cannot add external team members. See https://developer.apple.com/support/roles/ If you have signed up as an Individual, you will either have to do some of the work yourself (certificates, app upload, etc), or trust your developers.
Apr ’22
Reply to Mapkit Type
The native SwiftUI Map is quite limited, it can't display a satellite view. You will have to use a UIKit MKMapView, and wrap it in UIViewRepresentable. (There are plenty of articles on the web explaining how to do this.)
Apr ’22
Reply to what's single view app in xcode13.3.1?
Just "App".
Replies
Boosts
Views
Activity
May ’22
Reply to VStack adds a space when I have a ZStack with multiple items inside
The vertical spacing is set by the VStack. If the VStack's "spacing" is nil, then the stack will "choose a default distance for each pair of subviews". As you are seeing, this distance is not necessarily the same for every pair of views. It's not possible to specify the spacing within the VStack. The only way to enforce the VStack spacing of 0 is to use: VStack(alignment:.leading, spacing: 0) { ...which you can't do. So I think you are stuck.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Guideline 3.2.2 - Business - Other Business Model Issues - Unacceptable
review your app concept and incorporate different content and features
Replies
Boosts
Views
Activity
May ’22
Reply to Unexpected non-void return value in void function
In getData(), you "return dumm" within a closure which executes asynchronously. That is, it can execute after getData() has returned. So getData cannot return it's Double value there. The closure itself does not return a value (hence the error message). And since you only retrieve "dumm" within the closure, you cannot use getData's return value to return dumm. You should probably remove the return value from getData, and handle the closure's result somehow (e.g. by passing a completion closure to getData, which can then process "dumm"). By the way, it would be easier to help you if you could use (instead of your mass of code, and a screenshot) a Code Block for your code, and use "Paste and Match Style". Like this: //MARK : HealthStore func getData() -> Double { //Get Authorization let stepType = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)! let heartRate = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.heartRate)! let spo2 = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.respiratoryRate)! healthStore.requestAuthorization(toShare: [], read: [stepType,heartRate,spo2]) { (chk, error) in if (chk){ print("Permission Granted") var dumm = 0.0 //currentHeartRate(completion: nil) self.getSteps(currentDate: Date()) { result in globalString.todayStepsCount = result dumm = result print(result) } return dumm } } } //getData func getSteps(currentDate: Date, completion: @escaping (Double) -> Void) { guard let sampleType = HKCategoryType.quantityType(forIdentifier: .stepCount) else { print("Get Steps not executed as is null") return } let now = currentDate //Date() let startDate = Calendar.current.startOfDay(for: now) let predicate = HKQuery.predicateForSamples(withStart: startDate, end: now, options: .strictEndDate) let query = HKStatisticsQuery(quantityType: sampleType, quantitySamplePredicate: predicate, options: .cumulativeSum) { _, result, _ in guard let result = result, let sum = result.sumQuantity() else { completion(0.0) return } completion(sum.doubleValue(for: HKUnit.count())) } healthStore.execute(query) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Expected declaration
CustomStringConvertible First conform AboutMe to CustomStringConvertible: class AboutMe: CustomStringConvertible { Then implement the description: var description: String { "\(firstName) \(lastName), age: \(age)" }
Topic: Business & Education SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Mac Mini M1 Hardware without case.
It's an interesting question! Apple will not sell you a Mac Mini without a case. I doubt anyone else would either: It's a very limited/specialist market They can't source such a product Your best option is to buy a Mac Mini, remove the innards, and recycle the case. That's all anyone else could do, and they would charge you extra for it. Perhaps when the "Self Service Repair" is more common, it will be easier/possible to source such components? https://www.apple.com/newsroom/2021/11/apple-announces-self-service-repair/
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Issue with split(or at least I think so)
You use: r = Int(key[0].split(",")[0]) * key[1] You could try breaking that line down into smaller components, to better understand why it doesn't work. For example: let x = key[0] No exact matches in call to subscript Oopsies! It's much easier to debug smaller statements. What you are calling "key" (bad name!) is actually a Dictionary<String, Double> So if you said: for dictionary in self { That would iterate through the dictionaries in your array... ...then you could action the values in the dictionary: for key in dictionary.keys {
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Testflight
Ask the App Developer for one.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Expected declaration
You have added your last two lines as part of the class definition, which is an error. Try putting them in a method, like this: func test() { let myInfo = AboutMe(firstName: "NAME", lastName: "NAME", age: 10) print(myInfo) } Note: That will compile okay... But it will probably not print what you are expecting, as you have not conformed "AboutMe" to CustomStringConvertible, but that's a different question!
Topic: Business & Education SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Can't Generate Promo Codes
If the app has not been released, then the Promo Codes can not be used, so it doesn't make sense to generate them. Promo Codes are a way of providing free copies of a paid app. They are not used for a preview version of the app, before it is released. For that, you would use TestFlight.
Replies
Boosts
Views
Activity
Apr ’22
Reply to Why is animation parameter for UIView.transition(with:duration:options:animations:completion:) optional
Possibly because "NULL" is not the same as "nil"! At least... they are the same, but they aren't. NULL is a generic pointer value nil is the absence of a value of a certain type See https://swiftbydeya.com/swift-the-difference-between-nil-nil-null-nsnull/
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Working with Contractors
I'm very wary of {sharing my apple dev credentials} Rightly so! Is your Apple Developer account as an Individual or an Organization? "Individual" accounts cannot add external team members. See https://developer.apple.com/support/roles/ If you have signed up as an Individual, you will either have to do some of the work yourself (certificates, app upload, etc), or trust your developers.
Replies
Boosts
Views
Activity
Apr ’22
Reply to Error "Missing argument for parameter #1 in call.
Include missing code for ExampleView, examples, selectedID, namespace, show
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Mapkit Type
The native SwiftUI Map is quite limited, it can't display a satellite view. You will have to use a UIKit MKMapView, and wrap it in UIViewRepresentable. (There are plenty of articles on the web explaining how to do this.)
Replies
Boosts
Views
Activity
Apr ’22
Reply to UI Stepper implementation - start counting over
Hint: when pasting code, use "Paste and Match Style", to avoid all the extra blank lines.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’22