Post

Replies

Boosts

Views

Activity

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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
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); } }; };
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
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.....
Jan ’25
Reply to AppStoreConnect API - How to set pricing
Thanks to Grok v2 I have a possible solution (Apparently “grok v2” is an LLM “AI” thing, in case anyone else is unfamiliar.) I’m not impressed by the code it has given you. I think you’ll have more luck with the code posted by GrayDev in November. I asked this question in January of 2023 and never received an answer from Apple, at least not one that was worth a damn. Right, but you did get answers from the rest of us. I linked to my code for settings IAP pricing in July 2023, which you could have tried to repurpose but you didn’t. Then in November 2024 GrayDev posted code to do exactly what you want (and which is, as I suspected, very similar to my IAP code). Then ECDev1 posted a link to their version of that on Stackoverflow. You don’t seem to have acknowledged those posts at all. They will solve your problem; the “AI hallucination” won’t.
Jan ’25