Post

Replies

Boosts

Views

Activity

Why HKObjectType instead of HKQuantityType?
The requestAuthorization method in WorkoutManager wants to read HR, energy, distance and "activity" information all of which are HKQuantityTypes. //The quantity types to read from the health store let typesToRead: Set = [ HKQuantityType.quantityType(forIdentifier: .heartRate)!, HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned)!, HKQuantityType.quantityType(forIdentifier: .distanceWalkingRunning)!, HKQuantityType.quantityType(forIdentifier: .distanceCycling)!, HKObjectType.activitySummaryType() ] The documentation for HKObjectType states: The HKObjectType class is an abstract class. You should never instantiate an HKObjectType object directly. Instead, you always work with one of the following concrete subclasses: ... HKQuantityType Replacing HKObjectType.activitySummaryType() with HKQuantityType.activitySummaryType() in the above code doesn't appear to cause any issues with the app. Intuitively, it should work exactly the same since HKQuantityType (being a concrete subclass of HKObjectType) inherits directly from HKObjectType. Is my understanding correct or have I missed something fundamental? If my thinking is correct, why is HKObjectType used in the sample code when all of the other set elements use the HKQuantityType subclass?
0
0
886
Jun ’21
Unresponsive, Freezing, Lagging, Home Screen iPhone iOS 14.2 (18B92)
Unlocking the phone occasionally freezes, hangs, lags and is generally unresponsive for a period of up to 30 seconds. The issue is not affecting every unlock, but its frequency is enough to be irritating to say the least. Out of 27 pickups today, easily 50% have presented an unresponsive UI. There is 86GB/128GB storage available, and the issue was first noticed with an iOS 14 beta, suggesting that the issue may be software related. Others have reported iOS 14 issues elsewhere, anyone else experiencing this or something similar?
0
0
442
Nov ’20
Alert popping up: "A new iOS update is now available. Please update from the iOS 14 beta"
Alert: “A new iOS update is now available. Please update from the iOS 14 beta” In Settings/general/Profile there is only an option to Remove Profile. After removing the profile, backing-up and archiving the iPhone backup, a new profile was downloaded from beta.apple.com/profile, but alert persists. It seems that other developers are experiencing similar issues. Any ideas for resolving this issue?
23
0
4k
Oct ’20
"Supports opening documents in place" info.plist entry required for ShapeEditApp?
The following warnings presented themselves when the Document groups example code is built from the App essentials in SwiftUI session. warning: The application supports opening files, but doesn't declare whether it supports opening them in place. You can add an LSSupportsOpeningDocumentsInPlace entry or an UISupportsDocumentBrowser entry to your Info.plist to declare support. (in target 'NewInSwiftUI' from project 'NewInSwiftUI') And another "purple" warning: Multiline Type "com.example.ShapeEdit.shapes" was expected to be declared and exported in the Info.plist of NewInSwiftUI.app, but it was not found. After adding the "Supports opening documents in place" info.plist entry and an "Exported Type Identifier" to the project target, the warning goes away whether this boolean is set to Yes or No. What does this plist entry do (apart from the obvious)? Interestingly, the warning does not return if the "Supports opening documents in place" and "Exported Type Identifier" info.plist entries are removed. Xcode seems to be hanging on to the bones of the "Exported Type Identifier" which can be seen when a commit is initiated with Xcode Source Control.
0
0
4.3k
Jul ’20
Gauge appears as a slider on watchOS
The code available for this WWDC session produces something like a slider on the watch. Also, the set value can be shown or the two extreme values, but not both. Finally, the foreground colour of green will not apply. Any ideas? 17:32 mark struct ContentView: View { 		var acidity: Double 		var body: some View { 				Gauge(value: acidity, in: 3...10) { 						Label("Soil Acidity", systemImage: "drop.fill") 								.foregroundColor(.green) 				} 		} } 17:52 mark struct ContentView: View { 		var acidity: Double 		var body: some View { 				Gauge(value: acidity, in: 3...10) { 						Label("Soil Acidity", systemImage: "drop.fill") 								.foregroundColor(.green) 				} currentValueLabel: { 						Text("\(acidity, specifier: "%.1f")") 				} 		} } 18:00 struct ContentView: View { 		var acidity: Double 		var body: some View { 				Gauge(value: acidity, in: 3...10) { 						Label("Soil Acidity", systemImage: "drop.fill") 								.foregroundColor(.green) 				} currentValueLabel: { 						Text("\(acidity, specifier: "%.1f")") 				} minimumValueLabel: { 						Text("3") 				} maximumValueLabel: { 						Text("10") 				} 		} }
0
0
525
Jul ’20
ProgressView produces spinning wheel instead of circular ring
Hello all! Why does the classic spinning wheel ProgressView when specifying the style for the circular band/ring? Additionally, if the progressViewStyle modifier is not added to the ProgressView, a progress bar is displayed to the indicated percentage (33%) instead of the default spinning wheel. - Unless, that is I got the wrong end of the stick... ProgressView("Completed", value: 0.33) .progressViewStyle(CircularProgressViewStyle())
7
1
1.7k
Jul ’20
Cannot find type 'DynamicCharacterSelectionIntent' in scope
and, Type 'Provider' does not conform to protocol 'IntentTimelineProvider' in EmojiRangerWidget.swift. The Provider will not conform presumably if it cannot find 'DynamicCharacterSelectionIntent'. So, why would that be? After comparing with the "final" version of the example code, it became apparent that the EmojiRangerWidget was no longer a target member of EmojiRangerWidgetExtension, but now a member of CharacterDetailExtension. When I remove membership from EmojiRangerWidgetExtension of EmojiRangerWidget it suddenly is able to "find" DynamicCharacterSelectionIntent and the protocol non-conformance issue goes away. It would be really helpful, having come this far in the Widget creation journey, to understand why I am observing the above behaviour and how the CharacterDetailExtension should be created.
0
0
750
Jul ’20
Cannot find 'CharacterDetail' in scope - IntentHandler.swift
This last part of Widgets Code-along was great, and resulted in lots of questions. The first of which is why Swift cannot find CharacterDetail from the IntentHandler? Swift didn't have a problem prior to creating IntentHandler finding CharacterDetail. My code has been building all along but I have noticed a target that appears in the example code that does not appear in my code. A target called CharacterDetailExtension seems very conspicuous, but Izzy didn't mention anything about the creation of it. Nevertheless, it would be interesting to know why CharacterDetail is suddenly out-of-scope? And what is the CharacterDetailExtension target and how is is created?
1
0
998
Jul ’20
Why is the Spicy Banner mis-aligned?
The demo in the Introduction to SwiftUI showed a nicely aligned "🔥Spicy" Label consisting of a String and the flame.fill SF symbol. However, with the code below (appearing immediately before the closing bracket for the VStack in the body property within the SandwichDetail struct), the label appears misaligned. The single flame.fill symbol appears as normal, but as though it occupies the space that two flame.fill symbols would occupy if stacked vertically. Only one symbol is visible but as though on the preceding line relative to the Spicy string following immediately after.             if sandwich.isSpicy && !zoomed {                 HStack {                     Spacer()                     Label("Spicy", systemImage: "flame.fill")                     Spacer()                 }                 .padding(.all)                 .font(Font.headline.smallCaps())                 .background(Color.red)                 .foregroundColor(.yellow)                 .transition(.move(edge: .bottom))             }
4
0
923
Jun ’20
.toolbar modifier positions buttons at the bottom of the view
Following the coding intro to SwiftUI a curiosity arose with regard to the toolbar placement in the view. The first question is regarding the use of the toolbar modifier. The demo showed the buttons appearing at the top of the view, but they appear at the bottom of the view in my rendition, despite applying the modifiers to different blocks within the body calculated property. Any ideas as to why this would be would be appreciated. Additionally, the question begs as to whether the .navigationBarItems modifier is to be replaced by the new toolbar modifier? Or, will it simply be added to the toolset?     var body: some View {         NavigationView {             List {                 ForEach(store.sandwiches) { sandwich in                     SandwichCell(sandwich: sandwich)                 }                 .onMove(perform: moveSandwiches)                 .onDelete(perform: deleteSandwiches)                                  HStack {                     Spacer()                     Text("\(store.sandwiches.count) Sandwiches")                         .foregroundColor(.secondary)                     Spacer()                 }             }             .navigationTitle("Sandwiches")             .toolbar {                 #if os(iOS)                 EditButton()                 #endif                 Button("Add", action: makeSandwich)             }                          Text("Select a sandwich")                 .font(.largeTitle)         }     }
7
0
7k
Jun ’20