This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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