Post

Replies

Boosts

Views

Activity

Reply to Trying to better understand CGAffineTransform.... and need a bit of guidance.
So I'll most likely just perform the steps in what feels to me like the incorrect order. Here's an anecdote from about 1990: A friend was on a transatlantic flight, and the guy sat next to him had a laptop computer - which was a bit of a novelty at the time, and since this was before at-seat power, he also had a large bag of batteries to swap. (Yes, removable batteries!). My friend was of course watching what the guy was doing. He seemed to be writing 3D graphics code. He would hack around for a bit, then run it, quietly swear, and repeat. Eventually, my friend had to say something. "Excuse me", "Huh, yeah?", "You're multiplying the matricies in the wrong order. Swap A and B on line 481." Anyway. I don't recall the semantics of the Core Graphics transformation functions. There are definitely two ways of thinking about it. My preference with any API of this sort is to form the complete matrix myself and call a single API function to set it. Then I'm in control of what happens and I don't need to worry about whether this particular library does AxB or BxA. Beware that that's not the only way it can go wrong. There is one affine transformation API - I forget which one, maybe it's SVG? - where rotations are about the center of the image, not the origin! Good luck.
1d
Reply to learning coregraphics help: connecting line to circles
im in the process of delving more into coregraphics with swiftui Are you? Your code has this: Canvas { context, size in That’s this: https://developer.apple.com/documentation/swiftui/graphicscontext Which is not a Core Graphics context: https://developer.apple.com/documentation/coregraphics/cgcontext Don’t waste your time learning about Core Graphics if you are actually using a SwiftUI Canvas!
4d
Reply to Generating PDF SwiftUI
Can Core Text be used in conjunction with CGContext? Yes. See e.g. https://developer.apple.com/documentation/coretext/1509589-ctframedraw for how to draw a Core Text “frame” into a Core Graphics CGContext. Is PDFKit compatible with iOS? If you mean this: https://developer.apple.com/documentation/pdfkit then I believe it is only useful for displaying PDF, not creating it.
5d
Reply to Generating PDF SwiftUI
NSColor.red.cgColor NSColor is for macOS. Use UIColor on iOS. I see a lot of functions on the CGContext documentation page for text under the heading "Drawing Text" that does things such as setting the font, but I don't see a function that does the drawing. I believe you need to use Core Text instead of all that. The CGContext text drawing functions do exist, but you don’t immediately find them in the documentation because they are deprecated. Example: https://developer.apple.com/documentation/coregraphics/cgcontext/1586507-showtext I don’t know about the fileExporter thing.
5d
Reply to Generating PDF SwiftUI
I see how to draw shapes but how do you include text? https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_text/dq_text.html#//apple_ref/doc/uid/TP30001066-CH213-TPXREF101 I believe that you will need to use Core Text. Note: You may find 3rd-party libraries that are easier to use than all this Apple functionality. I'd say that using Quartz / Core Graphics / Core Text to create PDFs makes sense if you are already using those to create on-screen graphics within your app. If you aren't, do at least investigate what other options exist. I just googled "github swift PDF" and there are a few things. Of course you're not likely to get much feedback about those on this forum.
5d
Reply to Generating PDF SwiftUI
Is the documentation you provided also in C? The first link, yes. Second link, no. I think that the C docs, in particular the introductory sections, are probably worth looking at because they were written by actual human technical writers before Apple fired them all. The modern docs are automatically generated from the code and much harder to understand, especially in terms of understanding the basic concepts. But if you get totally bogged down by not understanding the C, then just use the Swift docs at the second link. is there a way to include a C file in a SwiftUI project? Yes, but you probably don't need to do that. What are values, keys, and dictionaries? In Swift: https://developer.apple.com/documentation/swift/dictionary In the C code you're looking at, it's doing essentially the same thing but in a much more verbose fashion because these things are not built in to the language, but requite lots of library function calls to use.
5d
Reply to SwiftUI flash animation
I now have something like this: struct MyView: View { let value: String; let flash_duration = 0.1; var body: some View { ZStack { Capsule() .phaseAnimator([false,true], trigger: value) { content, phase in content .foregroundStyle(phase ? .primary : .green); // Note not .fill } animation: { .linear(duration: flash_duration/2) // I wonder what the preferred curve is? } Text(value) .animation(.linear(duration: 0) .delay(flash_duration/2), value: value); } }; };
5d
Reply to SwiftUI flash animation
Thanks, I think I worked that out about the same time you posted. I currently have: PhaseAnimator([false,true], trigger: some_variable) { phase in Capsule() .fill(some_colour) .opacity(phase ? 0 : 1); }; I've not yet worked out how to set the animation duration (etc.) with this form, though I've not really looked yet. I've also not yet looked at how to delay the change of the Text (in my original post) to the midpoint of the flash. I think I need a "non-animation", i.e. an animation that instantly changes from the old to the new value, with a suitable delay. Or something.
5d
Reply to Generating PDF SwiftUI
the function is declared with "void". What language is that? C But… that part of the document is about reading a PDF document, not creating one. I think you want this part for creating PDF: https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html#//apple_ref/doc/uid/TP30001066-CH203-TPXREF118 Swift docs for CGContext: https://developer.apple.com/documentation/coregraphics/cgcontext There may be other, non-Apple, ways to do this.
6d
Reply to Apple keeps preventing us for updating our app
As I understand it, the people that you speak to on these calls have no "inside information". All they can see is the same that you can see in the web interface, i.e. the "...similar to other apps..." message. They make a guess about what you should do, without telling you that it's only a guess - and I guess that they don't get any feedback about whether your subsequent submission was accepted. As you probably know there are numerous other posts here from people getting these rejections. Few (if any) report back with a positive outcome. (Please, do keep us informed about your case so that others can learn from it.) Personally, I do wonder if the "similar binary" message is related to one of the cross-platform app builder tools. How is your app built? But that is only my speculation. Apple do sometimes accept critical bug fixes despite other issues being unresolved. Have you asked about this? Good luck. P.S. I note than in your other thread, someone upvoted the App Review reply.....
6d