Post not yet marked as solved
I have spent hours trying to get @Query macros to compile. Mostly they throw up meaningless errors for example the following produces 3 compiler errors:
@Query var stylesheets: [StyleSheet]
Here's the expansion.
The compiler complains that 'private' can't be used here, and it can't find _stylesheets. I searched everywhere to find a resolution then I came across the Query struct. I used it as follows to replace the @Query:
let query = Query(FetchDescriptor<StyleSheet>(), animation: .smooth)
let styleSheets = query.wrappedValue
This also solves another issue that was bugging me - how to get the context when the environment variable is often rejected. All I need to do now is write:
let context = query.modelContext
None of the WWDC23 SwiftData videos mentions the use of the struct, which is a shame. It feels much like the CoreData approach to fetching data.
I hope this helps some of you.
Near the bottom,
Describing data use in privacy manifests, says:
App extensions don’t include privacy information files. The operating system and App Store Connect use the privacy information file in the extension’s host app bundle, in combination with those from third-party SDKs your app links to.
Yet the warnings email we see lists the app's extensions as missing manifests.
Are we reading the documentation incorrectly?
Getting this clarified helps us justify approvals for the additional work.
i have a code only static library framework and added PrivacyInfo.xcprivacy file inside.
because there are no resources required in runtime,
app using that framework can build without embedding.
finally there are no PrivacyInfo.xcprivacy file in app bundle.
is this correct intended operation?
some steps to propagate and merge static framework's privacy manifest to app's privacy manifest not needed?
Post not yet marked as solved
I am exploring Appi-Intent and Appshortcut. We can create an action shortcut by using the following code.
struct WatchListShortcut: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: WatchListAppIntent(),
phrases: [
"Tell \(.applicationName) to open first item in watch list",
],
shortTitle: "WatchList item",
systemImageName: "systemimage"
)
}
}
What I want to show an entity shortcut like shown in the below screenshot.
linkText
I am not sure how to create the shortcut like Assigned one in the above screen.
Post not yet marked as solved
I have tried the codes in this page
https://developer.apple.com/forums/thread/731271?answerId=755458022#755458022
.scrollPosition(id: $dataID) is supposed to keep the current ScrollView position.
However, none of them work.
I use Xcode 15.3. Tested on iOS 17.0.1 and iOS 17.4 simulators.
The people in the page talk like it works for appending, not for prepending.
But in my tests, none of them keeps the scroll position.
The scroll view will scroll to other part, without changing the dataID.
It will update the dataId to the current value only when I scroll manually.
It's not possible to merge a framework with resource into an iOS app target because the resource are not included in the app bundle.
Steps to reproduce:
Create an Xcode Project with iOS App Template
Add a Framework Target (make sure to "Embed in Application")
Add an Asset Catalog to Framework Target
Add an Color Resource (or Image Set, or any other Resource)
Reference the Resource in App Target (I have used a SwiftUI View)
Run on Device (!) to make sure everything works as expected
Change "Create Merged Binary (MERGED_BINARY_TYPE)" build setting of app target to "Automatic (automatic)"
Change app target settings to link, but not embed framework target (e.g. change from "Embed and Sign" to "Do Not Embed" in "Frameworks, Libraries and Embedded Content" section in "General" tab)
Run again (on Device!) and observe how the resources framework resource cannot be found anymore (using SwiftUI you will see a "No image/color named '...' in asset catalog for ..." error message in console logs)
Note:
Everything works fine in Simulator
Same behavior for Release and Debug configuration
Same behavior for manual and automatic merging
Same behavior for resources which are not bundled in Asset Catalog
When archiving the app, an "Assets.car" file is never present (even when creating archiving for Simulator target, when "Allow archiving for Simulator" is enabled)
Reported as FB13716505
Test Project: https://github.com/iteracticman/MergeableResources/
Post not yet marked as solved
I have a question. When the DDM status report is sent from a DDM device, normally an empty response is returned. However, if we return a non-empty response that includes an arbitrary string, the device sends us the declaration-items request. Is this behavior correct?
device| --status reort--------> |server
device| <------a non-empry----- |server
device| --declaration-items---> |server. Is this behavior correct?
Post not yet marked as solved
Where can I find the Puzzle Game demo code they showed in the video for lift subjects from images in the app? Thank you!
https://developer.apple.com/videos/play/wwdc2023/10176/
Post not yet marked as solved
I am trying to find how to configure an application when using an AppManaged declaration. Using MDM, I would send the install command and include the settings in the 'Configuration' key of the command. I have checked the documentation and rewatched the 2023 WWDC video, but it is not mentioned at all.
AppManagedAttributesObject has specific configuration options and doesn't appear to cater for adhoc app specific configurations.
Anyone found a way to accomplish this? There are a number of apps (store and enterprise) that require this functionality in order to be configured remotely.
Post not yet marked as solved
How would one update the position of a SwiftUI Map without impacting the zoom (or distance from a MapCamera point of view). So want:
a) map position being updated by incoming GPS co-ordinates
b) user may then on the Map zoom in/out
c) on subsequent GPS position changes I want to to keep the zoom/distance changes from the User and not reset these
From the code below the the issue seems to be when getting the current "distance" (i.e. mapCamPost.camera?distance) that this value seems to go to "nil" after the User zooms in the map.
struct GCMap: View {
@StateObject var locationMgr = GcFlightState()
@State private var mapCamPos: MapCameraPosition = .automatic
var body: some View {
ZStack {
Map(position: $mapCamPos) {
Annotation("UserLocation", coordinate: self.locationMgr.location.coordinate) {
Image(systemName: "airplane.circle").rotationEffect(.degrees(270))
}
}
.onMapCameraChange() {
print("onMapCameraChange \(mapCamPos.camera?.distance)")
}
.onReceive(locationMgr.$location) { location in
mapCamPos = .camera(MapCamera(
centerCoordinate: location.coordinate,
distance: mapCamPos.camera?.distance ?? 1000, // <<===
heading: location.course
))
}
}
}
}
Post not yet marked as solved
Are mergeable libraries compatible with digital signatures and privacy manifests? If so, what happens to the privacy manifests from each merged library? Do they get merged?
Post not yet marked as solved
Lets say i have an sdk that is not one of those listed, but it uses one of those listed. In this case, do i have to get the sdk im using to update their dependency to add the required signature and privacy manifest?
Post not yet marked as solved
I am assuming that even if the app i am using is not listed in the ios list of privacy impacting sdks, if they use a privacy impacting sdk in their sdk, then my app will be required to get the privacy manifest for that privacy impacting sdk: the rule must (logically!) be transitive.
So far apple has not sent any email about the app needing to provide that for any of our sdks. but i am worried that maybe apple has not done the check for us yet, and by the time they do , we will be near deadline to submit an app.
Post not yet marked as solved
Do I have to add the Privacy Manifest file in my SDK if I'm not using any required reason APis and not collecting any data?
Post not yet marked as solved
It just a simple contact book app, and there are some model stored through SwiftData
import Foundation
import SwiftData
protocol aData: Equatable, Identifiable {
var label: String { get set }
var value: String { get set }
init(label: String, value: String)
}
@Model
class aNumber: aData, Identifiable {
var id = UUID()
var label: String
var value: String
required init(label: String, value: String) {
self.label = label
self.value = value
}
}
@Model
class aEmail: aData, Identifiable {... // here are sample with aNumber}
@Model
class aURL: aData, Identifiable {...}
@Model
class anAddress: aData, Identifiable {...}
@Model
class Contact: Identifiable {
var id = UUID()
var _firstName: String = ""
var _lastName: String = ""
var firstName: String {
get {
return _firstName
}
set {
_firstName = newValue
updateNameForSort()
}
}
var lastName: String {
get {
return _lastName
}
set {
_lastName = newValue
updateNameForSort()
}
}
var fullName: String { return _lastName + _firstName }
var pinyinName: String { return (...//some rules)}
var nameForSort: String
var company: String
var numbers: [aNumber]
var emails: [aEmail]
var URls: [aURL]
var dates: [Date]
var remarks: String
var tags: [String]
init(firstName: String, lastName: String, company: String, numbers: [aNumber], emails: [aEmail], URls: [aURL], dates: [Date], remarks: String, tags: [String]) {
...
}
convenience init() {
self.init(firstName: "", lastName: "", company: "", numbers: [], emails: [], URls: [], dates: [], remarks: "", tags: [])
}
func getFullName() -> String {
return self._lastName+self._firstName
}
func updateNameForSort() {
nameForSort = ...//some rules
}
}
And the ListView
import Foundation
import SwiftUI
import SwiftData
struct BookView: View {
@Environment(\.modelContext) private var context
@Query(sort: \Contact.nameForSort) private var Contacts: [Contact]
@State var isEditing = false
var body: some View {
let contactsDctionary = Dictionary(grouping: Contacts, by: {$0.nameForSort.prefix(1).uppercased()})
List {
ForEach(contactsDctionary.sorted(by: { $0.key < $1.key }), id: \.key) { key, contacts in
// group by initials
Section(header: Text(key)) {
ForEach(contacts, id: \.self) { Contact in
{ ...//some view
NavigationLink(destination: ContactView(contact: Contact)) {}
.opacity(0)
}
}
}
}
}
.listStyle(InsetListStyle())
.navigationBarTitle("All", displayMode: .large)
.toolbar {
Button(action: {
isEditing.toggle()
}) {
Image(systemName: "plus")
}
}
.sheet(isPresented: $isEditing) {
NavigationView {
ContactEditor(originalData: nil, isEditing: $isEditing)
}
}
}
}
And the contactView from navigationLink:
import Foundation
import SwiftUI
struct ContactView: View {
var contact: Contact
@State var isEditing = false
var body: some View {
List {
Section {
ForEach(contact.numbers) { aNumber in
row(aData: aNumber)
}
}
Section {
ForEach(contact.emails) { aEmail in
row(aData: aEmail)
}
}
}
.navigationTitle(contact.fullName)
.toolbar {
Button(action: {
isEditing.toggle()
}) {
Text("编辑")
}
}
.sheet(isPresented: $isEditing) {
NavigationStack {
ContactEditor(originalData: contact, isEditing: $isEditing)
}
}
}
}
Now I had some contacts had stored, they store some [aData] like the numbers: [aNumber], when I view them in contactView, their elements, such a list of the "aNumber" are arranged in some order(this is random), then I completely close the app and open it next time, the order of the array elements displayed just now has been completely disrupted.
So how to solve this problem? I just want to keep their order the same as when I append them in array.
In addition, English is not my mother ******. I hope you can understand my expression. I would be very grateful if anyone can solve this problem!
Post not yet marked as solved
As the new requirement for Privacy manifests is coming this Spring 2024 (https://developer.apple.com/news/?id=r1henawx), Apple released a list of SDK's that need to comply with this requirement and provide a privacy manifest file: https://developer.apple.com/support/third-party-SDK-requirements/
I have a SDK project that does not fall under the mentioned requirements。
collects data
uses of required reason API
includes listed Third-party SDK
I have some questions:
Do I need to include a privacy manifest file in my SDK project?
if so, is a blank privacy manifest file included in the SDK?
if not, is it possible to publish an App that use my SDK, without a privacy manifest file?
Post not yet marked as solved
One of the conditions for the challenge is that it must be offline. Is this related to the use of AI?
Post not yet marked as solved
can i use AI scanning phone camera in WWDC Swift student challenge ?
Post not yet marked as solved
Hi,
I've implemented the Privacy Manifest in my app and specified my tracking domain as required, setting NSPrivacyTracking to true and listing my domain under NSPrivacyTrackingDomains However, on iOS17 when I decline the App Tracking Transparency (ATT) request, the specified tracking domain isn't blocked by iOS, contrary to my expectations. Shouldn't Apple's framework automatically block the domain and indicate this action in Instruments, allowing developers to verify the domain is indeed blocked when tracking is denied?
<key>NSPrivacyTracking</key>
<true/>
<key>NSPrivacyTrackingDomains</key>
<array>
<string>traking.example.com</string>
</array>
Post not yet marked as solved
If my app utilizes ASWebAuthenticationSession or SFSafariViewController, do I need to add all potential tracking domains that users may access within the session?
There is virtually no way to limit the URLs or domains that users can access within the ASWebAuthenticationSession or SFSafariViewController, so how can I know all the potential domains?