Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
85 views

The different coordinate systems of Cocoa and UIKit cause problem when drawing a string in a UIGraphicsContext. I have written code for macOS, where I draw a combination of primitives, attributedText, ...
MassMover's user avatar
  • 577
0 votes
0 answers
86 views

I was trying to use an AttributedString to represent a diff. I used a red/green background color on the removed/added lines. I would like the background to extend until the end of the line (ie up to ...
Guig's user avatar
  • 10.6k
0 votes
2 answers
132 views

I want to implement a UITextView whose content consists of plain text and tags, where the tags are text with a rounded gray background. I tried to use NSAttributedString, but it cannot set rounded ...
user1605810's user avatar
-2 votes
1 answer
225 views

I'd like to use Markdown text in a UITextView. It looks simple, but I'm not getting the expected rendering of most elements. let mdString = """ # Headline This is a line. * Bullet 1 * ...
Mitch Cohen's user avatar
  • 1,665
2 votes
1 answer
153 views

I completely stuck with subclass NSTextAttachmentViewProvider in swift 6 concurrency. So lets say I have a simple custom NSTextAttachmentViewProvider: final shapeViewProvider: ...
rckoenes's user avatar
  • 69.5k
0 votes
0 answers
68 views

I want to implement a onTapGesture on multiple substrings of a string but keeping the whole text view appropiate. For example the String is, "By click on checkbox you agree to our terms of ...
ctr1L's user avatar
  • 17
6 votes
3 answers
1k views

I'm upgrading my project to Xcode 16. When using the following function, it renders correctly with Xcode 15 but it is not on Xcode 16. // The label created with `attributedText`. let label = UILabel() ...
user3297288's user avatar
0 votes
1 answer
45 views

This is how I defined my separator: extension NSAttributedString { static var separator: NSAttributedString { let attributes: [NSAttributedString.Key: Any] = [ ....
Bartłomiej Semańczyk's user avatar
1 vote
1 answer
140 views

We have previously solved similar issues like: SwiftUI tappable subtext But how do you make subtext tappable, and also pop a dropdown at it's location when tapped? Do we need to use a webview? Split ...
randomor's user avatar
  • 5,745
0 votes
2 answers
89 views

I'm trying to apply a rounded stroke effect to text using NSMutableAttributedString in Swift. I have been able to find various NSMutableAttributedString.Key options for text attributes like color, ...
Jabed Dhali's user avatar
1 vote
0 answers
102 views

Im working on an IOS app using swift and facing an issue with NSAttributedString where im trying to apply a hyperlink to a substring of a text. The hyperlink is functional but the link color remains ...
PlatyPlayer's user avatar
0 votes
1 answer
133 views

In my code I simply have: let adminName = " ADMIN " let name = [adminName, "Greg Weg"].joined(separator: " ") let attributed = NSMutableAttributedString(...
Bartłomiej Semańczyk's user avatar
1 vote
1 answer
112 views

I'm trying to parse html text that contains a youtube video. To display this video I use a preview image. Initial text: <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod ...
Astro's user avatar
  • 11
1 vote
1 answer
231 views

In the code below, I am loading a markdown string in NSAttributedString. One of the feature in the app needs functionality to convert NSAttributedString back to plain markdown text. To achieve that, I ...
Kaunteya's user avatar
  • 3,119
0 votes
1 answer
47 views

I've got this HTML text: "<style>* {font-size: 12pt !important;color: #000000 !important;font-family: Montserrat-Regular !important;}</style>Perform the following steps:<br><...
Bawenang Rukmoko Pardian Putra's user avatar
0 votes
1 answer
229 views

I am able to demonstrate my issue with this simple example. I am using AsyncDisplayKit / Texture in my iOS app. I have a ASTableNode which shows attributed strings. These will have images in them via ...
sudoExclamationExclamation's user avatar
0 votes
0 answers
175 views

App crashes when I try to convert HTML string to NSAttributedString and assign it to a textView. @IBOutlet weak var standingBillerNoteTextView: UITextView! self.standingBillerNoteTextView....
Gaurav Bisht's user avatar
-1 votes
1 answer
332 views

I have private var remark: AttributedString?, I want to check is remark is notEmpty then Show the View. While debugging, I'm getting this (lldb) po remark ▿ Optional<AttributedString> ▿ some : ...
Vikash Kumar Chaubey's user avatar
1 vote
1 answer
93 views

I have an NSAttributedString with two different font sizes for displaying currency in pennys. I need to apply strikethrough to all strings, but not to break line of strikethrough. How can I draw a ...
main_version_of_me's user avatar
2 votes
1 answer
109 views

I want to use text color in my NSTextVeiw / UITextView that adapts to the system appearance. Dark mode, white text, otherwise black text. I have the following NSAttributedString: #if os(iOS) let ...
Daniel's user avatar
  • 1,126
0 votes
0 answers
89 views

I tried to load font using CTFontCreateWithFontDescriptor() and it behaves differently than loaded using NSFont(). Let's say the goal is to load font using CoreText that is exactly the same as using ...
Marcel Kiss's user avatar
0 votes
0 answers
67 views

I am using NSAttributedString for my NSTextView for showing a hyperlink along with some other string. when my other string is long the link string gets wrapped (i.e that's the link string breaks and ...
RRSK01_11's user avatar
0 votes
1 answer
112 views

I let my user choose a font from their installed fonts, then use that font in three different contexts in my macOS app. The list of fonts itself uses NSFontDescriptor to create an attributed string, ...
Craig's user avatar
  • 3,317
0 votes
1 answer
127 views

I'm working on a SwiftUI "live markdown editor" that formats and hides syntax in realtime as the user writes. I'm using NSTextView and NSViewRepresentable, and conditionally applying ...
RosTeHea's user avatar
1 vote
1 answer
93 views

I have a SwiftUI Texteditor and whenever I press the update button the color should be applied to the text however it just gets reseted to initialValue. Can anyone help me? import SwiftUI class ...
Karl Ehrlich's user avatar
0 votes
0 answers
66 views

I've tried so many of the other answers on here and none seem to work. This one seems closest but the solutions haven't helped. I'm displaying the following HTML (we get this back in a response): <...
vanilla_splsh's user avatar
0 votes
0 answers
112 views

I have these extensions to parse string with html tags to NSAttributedString extension StringProtocol { var html2AttributedString: NSAttributedString? { Data(utf8).html2AttributedString ...
Roman Markov's user avatar
0 votes
0 answers
64 views

I've got a component in a Swift 5 project inheriting from UIButton. The button has two sections of text: a heading (1 line) and a subheading (1+ lines). The two sections of text are formatted as a ...
Rufus's user avatar
  • 105
2 votes
1 answer
636 views

I am attempting to make something that would make it possible to add custom UIView subclasses as attachments in UITextView. As of iOS 15, there appears to be an API that allows you to register custom &...
martega's user avatar
  • 2,183
0 votes
0 answers
44 views

When we are using nsattributedstring to render html we are seeing unnecessary gaps. I tried using display mode inline tag. I have tried removing the '\n'. Many such things but html is rendering spaces ...
Nikhil Dhavale's user avatar
-1 votes
3 answers
92 views

I have a string value containing an amount, where I specified the decimal part as after "," and I want to change the font of the part after "," to be half of the other part private ...
HBK's user avatar
  • 15
0 votes
2 answers
267 views

Main problem: SwiftUI's Text() have no ability to fill large amounts of text inside. In case of text have too many symbols or in case of too large font it's displaying the following error: [Window] ...
Andrew's user avatar
  • 11.9k
0 votes
0 answers
43 views

I have an NSLayoutManager subclass, overriding - (void)drawGlyphsForGlyphRange:(NSRange)glyphsToShow atPoint:(CGPoint)origin and i'm trying to draw the NSAttributedString with CoreText. This is what i ...
SirRupertIII's user avatar
  • 12.6k
1 vote
1 answer
143 views

I found a bug which is to parse an HTML string with NSAttributedString and use it in a UITextView using AttributedText. The error is this: Assertion failed: (forceBreakIndex > NSMaxRange(...
Aditya Ramadhan's user avatar
1 vote
0 answers
215 views

In an attempt to expose the capabilities of NSAttributedString in combination with UITextView to the world of SwiftUI (specifically the ability to render basic HTML), I've wrapped UITextView in a ...
thomsmed's user avatar
  • 161
1 vote
1 answer
518 views

Starting in iOS 15, you can style text in UIKit with an AttributedString. You can treat the attributes as properties of the AttributedString, or you can make an AttributeContainer and treat the ...
matt's user avatar
  • 540k
2 votes
0 answers
880 views

I'm using the MarkdownUI library and through it I can create a markdown rendering as follows: let someText = " # Title ## Description ## Tables | Left columns | Right columns | | -------------...
Maykon Meneghel's user avatar
0 votes
1 answer
267 views

I am creating a simple application meant to read messages from the local iMessage database on OSX (macOS 13.4). These messages are stored as NSMutableAttributedStrings, which I understand to be a ...
alzee's user avatar
  • 1,396
1 vote
1 answer
174 views

I am currently developing a Notifications list screen that would display 4 types of notifications. Here is how it would look like in a very simple way: The main problem for me is to make the text ...
Stefan's user avatar
  • 35
2 votes
0 answers
101 views

I have a regular UITextField in my view controller: @IBOutlet private weak var textField: UITextField! This text field has a delegate set to it, as well as an event listener. Whenever a text value ...
zbx's user avatar
  • 289
0 votes
1 answer
1k views

I have a FAQ page with cells that have a title as a String and a description as an AttributedString so that I can customize the appearance of the link in description. How can I open a link in an app ...
Anna's user avatar
  • 43
1 vote
0 answers
197 views

Getting memory leak when converting HTML string to AttributedString using below String extension Usage: self.lblHeader.attributedText = "<H1>Hello world</H1><h2><b>, abc&...
S K's user avatar
  • 91
1 vote
2 answers
871 views

I have posts on my app where users can tag other users, the expectation is that these tags should be tappable and trigger a function when tapped. For example the post: "hello @someUser and @...
Noah Iarrobino's user avatar
1 vote
1 answer
479 views

I'm trying to support bulleted list formatting in a UITextView in my app. I've googled around and found various answers to questions (like here) that suggest using NSParagraphStyle. Right now to make ...
Tom Hamming's user avatar
0 votes
1 answer
1k views

I'm trying to create a view in my app that displays a chunk of text. I want certain words within that text to be a clickable link that opens up another view. I've been googling for a long time and can'...
mzm0227's user avatar
  • 65
7 votes
1 answer
472 views

When building for iOS 16.4, we noticed different behavior when it comes to using baselineOffset on an NSAttributedString. positive values are now handled differently than on previous iOS versions (no ...
Elie Hage's user avatar
  • 135
0 votes
0 answers
74 views

When setting the .ligature attribute on an NSTextView, it gets overridden when adding both a .paragraphStyle and .baselineOffset attribute at the same time. Here's the example, adding the below code ...
thecoolwinter's user avatar
4 votes
1 answer
2k views

as you can see, after i build project on iOS 16.4 i faced a problem that baselineOffset is not like on iOS 16.0. what should i do? this is my code: class ViewController: UIViewController { @...
Sajjad's user avatar
  • 1,635
15 votes
1 answer
2k views

Does SwiftUI Text not work with NSTextAttachment? I have this AttributedString: var attributedString: AttributedString { var sampleAttributedString = AttributedString(sampleText) // Apply some ...
Crazed'n'Dazed's user avatar
1 vote
0 answers
208 views

I have an non-editable NSTextField which I'm filling with NSTextAttachments, each of which is styled like a token. I now want to be able to mouseover a token and get a cancel button in the token, ...
Nick K9's user avatar
  • 4,808

1
2 3 4 5
46