Post

Replies

Boosts

Views

Activity

Apple, please take this on board
Downloading Xcode used to be reliable. Now it only takes a single sub-second outage of your network to kick the download into oblivion and make it start again. Please can you put fault tolerance and recivery back into App Store for downloads. Not only does it take 10x as long with all the restarts, on some networks (like Starlink) where sub-second disconnects are expected, it uses up your entire data allowance by (for example) downloading 99% of the 3.21GB and then starting again, and again, and again.... I've reported this on feedback assistant, but did not get a repsonse. Alternativey do we need to go back to days of Mac OSX Tiger and ship developer CDs! I remeber getting my first developer kit back in the day, in a big box full of CDs and printed manuals! I think I still have them somewhere... and UPS would turn up every now and again with updates on CD! Ahhh....
4
0
626
Oct ’23
SwiftUI - drawing a temporary placeholder
I have a base view which displays a number of subviews at fixed positions. Its for laying out tables in a restaurant. The base view is an image of the restaurant floor, the subviews are images of tables. The user can click on a table and drag it about - so far so good, all working. Tables should only be placed in certain places, for arguments sake we'll say every 100 pixels (x and y) in the base view. While the user drags the table about smoothly, I'd like a "shadow" rectangle to snap to just the nearest available place that's allowable like it's saying "this is where the table will snap to when you drop it" Can someone help this old dinosuar by explaining how to include a temporary rectangle in a SwiftUI view that updates it's position during the DragGesture of the table? Thank you!
2
0
744
Oct ’23
Xcode 15 has issues downloading simulators
Downloading the large simulator files in Xcode used to be robust. Now however I find it almost impossible to download them as even the slightest transient netork outage will cause the download to fail. The process goes something like this... Install fresh Xcode 15, and open a porject that targets iOS. Xcode will prompt you to get the latest simulator: Click on get and the download will begin. After a small sub-second network outage it fails: Click on the info button to get more info: And show details gives: Could not download iOS 17.0 Simulator (21A328). Domain: NSURLErrorDomain Code: -1001 Recovery Suggestion: The request timed out. User Info: { DVTErrorCreationDateKey = "2023-09-20 11:27:17 +0000"; DVTRecoveryBlockKey = "<__NSGlobalBlock__: 0x106dd0810>"; NSLocalizedRecoveryOptions = ( Cancel ); NSRecoveryAttempter = "<_DVTErrorRecoveryHandler: 0x6000010e20b0>"; } -- System Information macOS Version 14.0 (Build 23A339) Xcode 15.0 (22265) (Build 15A240d) Timestamp: 2023-09-20T12:27:17+01:00
6
4
2.6k
Sep ’23
Using AVPlayerView (or AVPlayerLayer) to display in-memory video frames.
I have an app which receives video frames across a network using NDI. My app processes the frames and passes them to an output device (Blackmagic Ultrastudio Monitor 3G) ( which is not a video adapater.) this is all working. I would like to include a video-preview in my app window. I know I can add AVPlayerView (or AVPlayerLayer) to the window. But how can I pass video frames from my frame buffer to an AVPlayer instead of letting it ingest a file or URL? In other words, I don't want the AVPlayer to ingest a URL or HTTP STREAM, I already have the video frames in a memory buffer, how do I feed them to AVPlayerView?
0
0
1.1k
Aug ’22
Creating swift Data from c-type structs
I'm trying to get my head around Swift and have promised myself my next app will be a SwiftUI appp... I am trying hard to update my thinking away from C style pointers and so on, but here's something thats got me stumped so far. My app will communicate with an embedded network device. The device sends me packets of data with a well-defined header followed by an optional payload of data bytes. In C (on the device) the header is defined like this: typedef struct _MSG_TYPE { uint16_t sig; uint16_t len; // Total length of message, include header and playload; uint16_t type; uint32_t data; // 32 Bits of data. } MSG_t; And my app will respond with messages using the same type of header. Since I'm trying to do this in Swift I somehow need to get my C-type structs in-and-out of Swift style Data types. Here's my receive function: private func receive_data() { nwConnection.receive(minimumIncompleteLength: 1, maximumLength: 65536) { (data, _, isComplete, error) in if let data = data, !data.isEmpty { print("connection did receive, data: \(data as NSData) ") if let msgCallback = self.messageDeliveryCallback { msgCallback(data) } } if isComplete { self.connectionDidEnd() } else if let error = error { self.connectionDidFail(error: error) } else { self.receive_data() } } } And the callback which it calls looks like this: func messageDelivery(message: Data?) { if let data = message, !data.isEmpty {   } } So my questions is. In the callback - how do I get the data from the Data type into one of my MSG_t structs? Or is there a better way to extract the equivalent bytes? And for sending message back to the client, how do I get one of my MSG_t structs into a swift Data type? I looked at using something like: var getInfoMsg = MSG_t(sig: UInt16(MSG_SIG), len: UInt16(MemoryLayout<MSG_t>.size), type: UInt16(MSG_TYPE_GET_INFO), data: 0) var newData = Data(bytes: UnsafeRawPointer(getInfoMsg), count: Int(getInfoMsg.len)) But that doesn't seem right and give an error: No exact matches in call to initializer  Hah. Sorry if this is a ****** question - like I say, trying to learn swift, but I'm old and slow!! So how do I convert to/from my MSG_t to Data in swift?
0
0
747
Jul ’21
Is anyone serious on here?
These forums are really bordering on un-usable. I'm not trying to give the team who built them a hrad time - but we are developers, these are developer forums, and we're trying to help each other. But simple things like not being able to embed an image are essential for peer to peer developer forums. Can someone at apple please state what the thinking is? I would much rather post here than in StackOverflow - but there doesn't seem to be any real valuable developers left here now. I'd have thought that Apple would want to encourage their developers to meet here, as they (Apple) could learn so much about what is going on in the developer community without having to scrape it from other third party sites. I'm at a loss as to how we are supposed to help each other when you can't post links, embed images or even reply to a reply.
2
0
711
Sep ’20
Creating a quater-circle button?
An app I'm doing requires a big round segmented button in the middle. Like this... What! We are not allowed to attach or embed images? OK you can see an examaple here: h t t p s : / / w p h o s t . s p i d e r - e . c o m / n o n - w p / s p l o b _ f r e k k e r . p n g (If you take out all the spaces.) I'm wondering how you would layout the central segmented button? It's a large circle. The circle is split into four equal quadrants, and each quadrant is a separare button. I guess I could just do 5-different full size images (one for each possible button press, and one for no-button-preseeed) and then do some kind of hit test to see which area of the circle had been clicked. Or is there a way to draw a control which is non-linear in shape, like a quarter circle?
5
0
1.4k
Sep ’20
Acessing structs from Swift
My latest app communicates, via TCP, with an embedded device. The embedded device is programmed in C and sends my Swift app data encapsulated in "messages" which are actually structures defined like this: { uint16_t sig; uint16_t len; // Total length of message, include header and playload; uint16_t type; uint32_t data; // 32 Bits of data. } MSG_t; In my Swit app they arrive via NWConnection, and are sent to my controller delegate as Data (That's the swift type called Data, not just the general term 'data') So me question for you harties is this: How can I unpack this 'Data' into something resembling my C struct - and acess it's members by name. In Pseudo code I'd like to do something like: if let myData = data { myStruct = <cast myData.bytes onto a struct > if myStruct.sig == CORRECT_MSG_SIG { // do soemthig with the message... } } So is this possible? Is it the wrong approach? Is there a better approach?
2
0
850
Sep ’20
Forums - feedback
I'm not really liking the new forums. I guess I don't really get how they are supposed to work. I can see how using 'tags' to post and find content removes the need for someone to keep creating and pruning topics, but it really seems like form-over-function to me. Here's my gripes.. I just want to browse through all the questions that are in my area of skill, but so far have no answers.. So in the past I'd have drilled through to something like "Developer / Objective-C" - now there seems to be no structure at all. No way to just browse around. There's so much whitespace! My mouse-miles are through the roof, there doesn't seem to be good use of screen real estate. You can't reply to a reply. Again this looses structure and makes following a thread really tricky. When I have a question I'll most likley post one thats been asked before because I don't know what tags the first person will have used. I can't easily see all my own questions, to see if I have any replies. I can't easily see what questions I have contributed to. Stack0verflow is far better laid out, has much more fucntionality, is easier to search, easier to see threads, ... just easier. But Apple's most valuable people aren't going to post replies there. You can't subscribe to a topic, or even a question, and get notifcations or emails when someone resonds. There's probably more, but I can't think straight right now...
5
0
911
Sep ’20
NWConnection with .UDP never gets beyond 'Preparing' state
I'm trying to send data using UDP using the following code, But I never get any 'newState' other than .preparing: Do I need to set an entitlement or something, or have I missed a point somewhere? (iOS 13, Xcode 11.7, SwiftUI) var connection: NWConnection? var hostUDP: NWEndpoint.Host = "239.255.250.78" var portUDP: NWEndpoint.Port = 4002 func start() { print("UDP Provider has started") self.connectToUDP(hostUDP, portUDP) } func connectToUDP(_ hostUDP: NWEndpoint.Host, _ portUDP: NWEndpoint.Port) {     let messageToUDP = "ANNOUNCE"     connection = NWConnection(host: hostUDP, port: portUDP, using: .udp)     connection?.stateUpdateHandler = { (newState) in       switch (newState) {         case .ready:           print("State: Ready\n")           self.sendUDP(messageToUDP)           self.receiveUDP()         case .setup:           print("State: Setup\n")         case .cancelled:           print("State: Cancelled\n")         case .preparing:           print("State: Preparing\n")         default:           print("ERROR! State not defined!\n")       }     }     connection?.start(queue: .global())   }   func sendUDP(_ content: String) {     let contentToSendUDP = content.data(using: String.Encoding.utf8)     connection?.send(content: contentToSendUDP, completion: NWConnection.SendCompletion.contentProcessed(({ (NWError) in       if (NWError == nil) {         print("Data was sent to UDP")       } else {         print("ERROR! Error when data (Type: Data) sending. NWError: \n \(NWError!)")       }     })))   }   func receiveUDP() {     connection?.receiveMessage { (data, context, isComplete, error) in       if (isComplete) {         print("Receive is complete")         if (data != nil) {           let backToString = String(decoding: data!, as: UTF8.self)           print("Received message: \(backToString)")         } else {           print("Data == nil")         }       }     }   }
9
0
3k
Sep ’20
SwiftUI for complex user interfaces
I'm about to embark on quite a major new software release. It's a time-line based app (like iMovie or Final Cut Pro X) but it's not video editing. It's more like video arranging. (The app arranges video and audio clips for massive multi-screen displays, and then captures metadata from cameras and actors, while the videos are playing.). They don't play from the editor machine - it uploads them to client 'players' and simply controls and synchronises the playback of them. It will be exclusively for macOS (so no Windows or Linux) so I don't need anything which is cross-platform. There will be up to 100 'tracks' in the timeline, and on each track are multiple media clips (videos, animations, audio, etc) and each clip should show a thumbnail preview, and/or audio waveform. There will also be a preview pane in the UI, where any one selected media clip can be previewed, and an asset manager, and optional panes like data visualisers etc. So my questionn is, is SwiftUI a good choice for a complex userinterface, with a time-line style work area like this?
1
0
613
Jul ’20