String에 취소선 긋기

고양이발냄새·2023년 8월 10일
0
extension String {
    func strikeThrough() -> NSAttributedString {
        let attributeString = NSMutableAttributedString(string: self)
        attributeString.addAttribute(NSAttributedString.Key.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, attributeString.length))
        return attributeString
    }
}
profile
고양이좋아

1개의 댓글

comment-user-thumbnail
2023년 8월 10일

좋은 글 감사합니다. 자주 올게요 :)

답글 달기

관련 채용 정보