Posts

Post not yet marked as solved
2 Replies
1.2k Views
Does the new encrypted fields work with CloudKit JS? I have checked the API for CloudKit JS, and under CloudKit.Record there is no mentioning of encrypted fields. It feels like this API has not been updated for a while. Does this mean that if I use field-level encryption, I will not be able to use CloudKit JS?
Posted
by selveskii.
Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
It appears that on an Apple Silicon Macs, we cannot do unit tests for Swift Packages using Mac Catalyst. Steps to produce: 0. Get an Apple Silicon Mac. Go to an empty folder, create a new Swift Package using swift package init. Open the created Package.swift, select the running destination to be My Mac (Mac Catalyst). Run the tests. I was getting the following error: code signature in [generated test path] not valid for use in process using Library Validation: Trying to load an unsigned library. I did not get this issue on my Intel Mac. On Apple Silicon Macs, set the destination to an iOS simulator or a “pure” Mac destination also works. How to bypass this issue, or is this a bug from Xcode? I am running the latest Xcode 12.3.
Posted
by selveskii.
Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
I found that compared with TextKit 1, NSTextLayoutManager does not provide any opportunity to customize line rectangles. In particular, I cannot do much about the frame of a NSTextLayoutFragment. I am curious about the proper approach to: limit the width and horizontal offset of a paragraph; add spacing below and above a paragraph; enclose a paragraph along an arbitrary path. For the first question, I noticed that in the sample app, when layout comments, BubbleLayoutFragment does not change the positions of any characters. While it did override renderingSurfaceBounds, it merely expands the bounds, without moving its text contents. And there seems to be no way to do so. For the second question, I noticed that paragraphSpacing and paragraphSpacingBefore set on the paragraph style seems to have no effect. According to the video, all layout fragments are stacked like a list. Therefore, this is an intended feature, right? Right now, my solutions to the first two questions are: If I want to control the horizontal position of a paragraph, I could simply set headIndent and trailIndent on the paragraph style. If I want to add spacing above or below a paragraph, I can add empty lines and set minimalLineHeight for the newline character. Are those the recommended ways to achieve such effect? Personally, I am not very interested in the third feature, enclosing a paragraph along an arbitrary path. However, I am indeed curious about how to add paragraph-level attachment, such as an block image/custom view between paragraphs. I think what I could do is: add an empty new line and set its height to leave enough space for the custom view; configure a CALayer or even a view and put it where the new line should be; If I want to layout characters within a strange shape, I could compute the shape's height based on the width, using TextKit 1, and then insert the new line as in step 1. Is this the intended way to approach such situation?
Posted
by selveskii.
Last updated
.
Post marked as solved
2 Replies
1.1k Views
I am working on a custom editable text view recently and I would like to adopt new iOS 13 selection gestures through the newly added UITextInteraction.I started by implementing a subclass of UIView and making it conforming to the UITextInput protoocol. So far I have implemented all code for converting between selection range and screen point (hit-testing and rectangle for range). I have manually rendered selection and caret. I also use a tap gesture recognizer to update caret position whenever a tap happens.Then, I proceed to follow the session on UITextInteraction, following the three lines of code suggested there:let interaction = UITextInteraction()interaction.textInput = myTextViewmyTextVIew.addInteraction(interaction)Strangely, there seems to be no effect when I trying to playing around on the iOS simulator. Which piece of code should I look for any troubleshooting?A separate but closely related issue: which visual features are automatically provided when UITextInput protoocl is implemented correctly? Is it true that I have to use my own tap gesture recognizer to do the click-to-change-caret workflow? It feels something that can be handled by the system. Plus, is there some Apple-backed library to draw caret and selection, including the two vertical bars with balls boundaries for selection? I could draw them myself to make it mimick the system’s default visual look but it feels very anti-pattern.
Posted
by selveskii.
Last updated
.