Re: iOS: selectable but not editable text


Gerriet M. Denkmann
 

On 10 Apr 2022, at 14:11, Bob Stern via groups.io <bobs.lists@...> wrote:

On 9 Apr 2022, at 23:59, Gerriet M. Denkmann wrote:

NSTextField can set both isSelectable (true) and isEditable (false). So far so good.
But how to do this in iOS?

Is this a new project or one in which you already developed a lot of code? I get the impression it is new because your preceding post concerns an existing UIKit app that you want to port to Mac using Catalyst, whereas your second post, quoted above, implies you're starting from AppKit. If this is a new project, it might be easier to develop it in SwiftUI.
One project is just a toy to try Catalyst.
Another is a real project, which could be done via Catalyst (some minor problems)
A third is a real project, which could be not be done via Catalyst, because it crashed on UIReferenceLibraryViewController (which is marked “Availability Mac Catalyst 13.1+”)


I tried SwiftUI (on macOS) some time ago. But gave up, because: Cannot select (and by implication: cannot copy) Texts.

HStack
{
Text("Day: \(self.sets.globalTime)")
Text("Susceptible: \(String(format: "%.1f", 100 * self.sets.sCnt))")
… more Texts ...
Spacer()
}
.padding(5)

How can I make my Text selectable?


Gerriet.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.