일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- collectionview
- map
- rxswift
- Refactoring
- 애니메이션
- 리팩토링
- RxCocoa
- ios
- clean architecture
- swift documentation
- 클린 코드
- swiftUI
- UICollectionView
- Protocol
- MVVM
- 스위프트
- SWIFT
- Xcode
- ribs
- UITextView
- tableView
- 리펙토링
- uiscrollview
- HIG
- Observable
- combine
- 리펙터링
- Clean Code
- Human interface guide
- uitableview
- Today
- Total
목록string (3)
김종권의 iOS 앱 개발 알아가기
문자열 index 접근 startIndex와 index(:offsetBy:) 사용 var str = "abc d e f" // a 가져오는 방법 str.first // 타입: Character?, String.Element str[str.startIndex] // 타입: Character // b 가져오는 방법 str[str.index(after: str.startIndex)] // d 가져오는 방법 str[str.index(str.startIndex, offsetBy: 4)] 특정 문자열 접근 firstIndex(of:) 사용 0~특정 index 가져오기 인덱스로 접근하면 타입이 String.SubSequence가 되므로 따로 String 변환이 필요 var str = "abc, def" // abc ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/su1Pv/btqPC0qOLgy/xVwAMf4GTXJWedTdJjPvF0/img.png)
기능 구현 내용 // // ViewController.swift // StringProcessing // // Created by 김종권 on 2020/12/10. // import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() print("12345".substring(from: 1, to: 3)) // 234 print("12345".remove(startInd: 2, length: 2)) // 125 print("12345".insertAt(2, string: "7")) // 127345 } } extension String { // from부터 to까지 String fun..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bmKPJc/btqN9N5ZBiQ/2Al3Aut3i9FCecKqLlYCNK/img.png)
AttributedString과 String의 차이 String은 단순히 text만 존재 AttributedString은 text에 attribute(속성 - Font, color, style등)이 추가 된 것 코드로 String의 attribute를 지정할 수 있는 장점 Label에 strike속성을 코드로 넣기 String의 extension으로 넣어서 사용 func strikeThrough() -> NSAttributedString { let attributeString: NSMutableAttributedString = NSMutableAttributedString(string: self) attributeString.addAttribute(NSAttributedString.Key.striketh..