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
756
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
913
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
3.1k
Oct ’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
861
Aug ’21