Post

Replies

Boosts

Views

Activity

Reply to How to structure code to handle mutations from Vision (face detection) requests
Replace mrbean with another image in the assets folder. import SwiftUI @main struct DevForumVisionApp: App { @StateObject var model = VisionModel() var body: some Scene { WindowGroup { ContentView() .environmentObject(model) } } } import SwiftUI import Vision struct ContentView: View { @EnvironmentObject private var model: VisionModel var body: some View { VStack { Image(uiImage: model.uiImage) .resizable() .aspectRatio(contentMode: .fit) Text("faces: \(model.faceCount)") } .onAppear(perform: { model.run() }) .padding() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .environmentObject(VisionModel()) } } class VisionModel: ObservableObject { @Published private(set) var uiImage = UIImage(named: "mrbean")! @Published private(set) var faceCount: Int = 0 private(set) var request: VNDetectFaceRectanglesRequest? private(set) var handler: VNImageRequestHandler? private(set) var requestOptions = [VNImageOption: Any]() init() { } func run() { handler = VNImageRequestHandler(cgImage: uiImage.cgImage!, options: requestOptions) self.request = VNDetectFaceRectanglesRequest() { [weak self] request, error in if error == nil, let count = request.results?.count { self?.faceCount = count } } if let request, let handler { do { try handler.perform([request]) } catch { print(error) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’23
Reply to IP Multicast - Packet sent on button click issue
import SwiftUI import os import Foundation import Network class MulticastController { var multicastIP : NWEndpoint.Host = "239.6.4.50" var multicastPort : NWEndpoint.Port = 5890 let group: NWConnectionGroup init() { let endpoints: [NWEndpoint] = [.hostPort(host: multicastIP, port: multicastPort)] guard let multicast = try? NWMulticastGroup(for: endpoints) else { fatalError("Multicast Group setup error") } let params: NWParameters = .udp params.allowLocalEndpointReuse = true group = NWConnectionGroup(with: multicast, using: params) group.setReceiveHandler(maximumMessageSize: 16384, rejectOversizedMessages: true) { message, data, isComplete in if let data, let value = String(data: data, encoding: .utf8) { print(message, value, isComplete) } else { print(message, isComplete) } } group.stateUpdateHandler = { (newState) in print("Group entered state \(String(describing: newState))") } group.start(queue: .main) } func sendMulticastPacket(message: String) { let data = message.data(using: .utf8) group.send(content: data) { error in if let error = error { print(error.localizedDescription) } else { print("ok") } } } } struct ContentView: View { var session = MulticastController() let message = "Hello World" var body: some View { VStack { Button(action: { session.sendMulticastPacket(message: message) }, label: { Text("Send Multicast Packet") } ) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Apr ’23
Reply to How do I respond to test device association?
Compliance is your best option, provide the required information in any of your apps meta data on App Store Connect, contact Apple DTS for clarification if your developer account is not being used on Test Devices by a 3rd party outside of your account's normal usage.
Replies
Boosts
Views
Activity
Apr ’23
Reply to How to structure code to handle mutations from Vision (face detection) requests
Replace mrbean with another image in the assets folder. import SwiftUI @main struct DevForumVisionApp: App { @StateObject var model = VisionModel() var body: some Scene { WindowGroup { ContentView() .environmentObject(model) } } } import SwiftUI import Vision struct ContentView: View { @EnvironmentObject private var model: VisionModel var body: some View { VStack { Image(uiImage: model.uiImage) .resizable() .aspectRatio(contentMode: .fit) Text("faces: \(model.faceCount)") } .onAppear(perform: { model.run() }) .padding() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .environmentObject(VisionModel()) } } class VisionModel: ObservableObject { @Published private(set) var uiImage = UIImage(named: "mrbean")! @Published private(set) var faceCount: Int = 0 private(set) var request: VNDetectFaceRectanglesRequest? private(set) var handler: VNImageRequestHandler? private(set) var requestOptions = [VNImageOption: Any]() init() { } func run() { handler = VNImageRequestHandler(cgImage: uiImage.cgImage!, options: requestOptions) self.request = VNDetectFaceRectanglesRequest() { [weak self] request, error in if error == nil, let count = request.results?.count { self?.faceCount = count } } if let request, let handler { do { try handler.perform([request]) } catch { print(error) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’23
Reply to Abuse of a leak in App-store relates to In-App Events , App store Fast Action need
That is keyword aggregation where results are the name of an app or a suggested set of keywords related to a set of apps using them search engine design 101 - palm on face.
Replies
Boosts
Views
Activity
Apr ’23
Reply to IP Multicast - Packet sent on button click issue
import SwiftUI import os import Foundation import Network class MulticastController { var multicastIP : NWEndpoint.Host = "239.6.4.50" var multicastPort : NWEndpoint.Port = 5890 let group: NWConnectionGroup init() { let endpoints: [NWEndpoint] = [.hostPort(host: multicastIP, port: multicastPort)] guard let multicast = try? NWMulticastGroup(for: endpoints) else { fatalError("Multicast Group setup error") } let params: NWParameters = .udp params.allowLocalEndpointReuse = true group = NWConnectionGroup(with: multicast, using: params) group.setReceiveHandler(maximumMessageSize: 16384, rejectOversizedMessages: true) { message, data, isComplete in if let data, let value = String(data: data, encoding: .utf8) { print(message, value, isComplete) } else { print(message, isComplete) } } group.stateUpdateHandler = { (newState) in print("Group entered state \(String(describing: newState))") } group.start(queue: .main) } func sendMulticastPacket(message: String) { let data = message.data(using: .utf8) group.send(content: data) { error in if let error = error { print(error.localizedDescription) } else { print("ok") } } } } struct ContentView: View { var session = MulticastController() let message = "Hello World" var body: some View { VStack { Button(action: { session.sendMulticastPacket(message: message) }, label: { Text("Send Multicast Packet") } ) } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Replies
Boosts
Views
Activity
Apr ’23
Reply to SwiftUI - Accessing StateObject's Object Without Being Installed on a View
Follow the design in this sample project: https://developer.apple.com/documentation/coredata/loading_and_displaying_a_large_data_feed
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’23
Reply to Simulator not reflecting simctl override --time command as expected
I tried it on the iPhone 12 iOS 15.4 sim, and it works. So it looks like the internals of the sim for 16+ have changed, making the commands useless.
Replies
Boosts
Views
Activity
Apr ’23
Reply to xcode erorr
How many main() functions and global variables with the same names do you have besides the one in main.cpp?
Replies
Boosts
Views
Activity
Apr ’23
Reply to App Store Name Unavailable
Welcome to the AppStore. You are one out of 2^64 developers submitting applications. You should have created your AppStore record months ago to reserve the name. Unfortunately, you will have to rebrand because the person with the first use is the copyright holder, as there was no proof you published the name first to stake a claim.
Replies
Boosts
Views
Activity
Apr ’23
Reply to Finder Stops Responding Using Ventura 13.3.1
I had this issue on the M2 shortly after the 13.3.1 update, but it hasn't happened recently.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Apr ’23
Reply to UDP LAN networking works in simulation but not iPhone device
It requires an entitlement from Apple. https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_networkextension https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_multicast
Replies
Boosts
Views
Activity
Apr ’23
Reply to ARKit stops providing Audio
Sorry, you'll have to post more code pertinent to what is giving trouble and details on what you're using the ARView for.
Topic: Spatial Computing SubTopic: ARKit Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Metal on Intel graphics: potential bug when using global constant arrays?
Because you are bypassing the processing of the values to any colour correction taking place after the shader is compiled.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Setting IAP so that monies are transferred to Client Bank Account
You have to transfer the funds to them or have the client set up an Apple Developer Account with their information to publish the app under their name and receive the funds directly should you be hit by a bus they will still be paid and not your estate.
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Call Recording in IOS 2023
Many before you have tried, but it is not allowed for privacy concerns.
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Upgraded Plasma Engine
Is there a question somewhere in your post?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’23