This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let htmlString = | |
""" | |
<div class="class-fr-editor"> | |
<span class="fr-video"><span class="thumb"><img data-src="https://download.hiclass.net/7e80/8680/9280/cf80/0a685485-0db8-49ff-adff-4e0fe969ed6d.jpg" class="lozad" src="https://download.hiclass.net/7e80/8680/9280/cf80/0a685485-0db8-49ff-adff-4e0fe969ed6d.jpg" data-loaded="true"></span></span> | |
<p></p> | |
<p></p> | |
<p><img class="fr-fic fr-dib lozad" data-src="https://download.hiclass.net/7e80/8680/9280/cf80/8ec6562d-b6c9-46b4-be21-1416dd83c624.jpg" src="https://download.hiclass.net/7e80/8680/9280/cf80/8ec6562d-b6c9-46b4-be21-1416dd83c624.jpg" data-loaded="true"></p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIImageView+.swift | |
// HEExample | |
// | |
// Created by hyonsoo on 8/11/24. | |
// | |
import UIKit | |
import ImageIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
public extension UITextView { | |
func numberOfLines() -> Int { | |
let numberOfGlyphs = base.layoutManager.numberOfGlyphs | |
var index = 0, lineCount = 0 | |
var lineRange = NSRange(location: NSNotFound, length: 0) | |
while index < numberOfGlyphs { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pattern = "[^\\dA-Za-z\\p{Hangul}]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
typealias BatchUpdatable = Identifiable & Equatable | |
/// 배치 업데이트를 위한 비교 모델 | |
/// | |
struct BatchUpdates { | |
let deleted: [Int] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TaskCancelledOnDismissView.swift | |
// SwiftUITaskWorkout | |
// | |
// Created by Paul Hudson. | |
// https://twostraws.gumroad.com/l/concurrency | |
// | |
import SwiftUI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TaskWithIdView.swift | |
// SwiftUITaskWorkout | |
// | |
// | |
// Created by Paul Hudson. | |
// https://twostraws.gumroad.com/l/concurrency | |
import SwiftUI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 배열의 조합 구하기 | |
/// 순서에 상관없이 같은 요소가 포함되어 있다면, 같은 조합으로 처리 (결국 처음 제공되는 배열 요소들의 순서를 유지한다) | |
/// - Parameters: | |
/// - arr: 제공되는 배열 | |
/// - select: 몇개의 요소를 선택해서 조합할지 결정 | |
/// - Returns: 제공된 배열에서 select 개를 선택해서 조합된 새 배열 | |
func getPermutations(_ arr: [Book], select: Int) -> [[Book]] { | |
var results: [[Book]] = [] | |
if select == 1 { | |
return arr.map { [$0] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Int { | |
/// 숫자 범위에 따라 텍스트 표시 | |
func readableCount() -> String { | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .decimal | |
formatter.groupingSeparator = "" | |
formatter.maximumFractionDigits = 1 | |
switch self { | |
case _ where self < 1000: | |
return "\(self)" |
NewerOlder