https://developer.apple.com/library/archive/documentation/WindowsViews/Conceptual/CollectionViewPGforIOS/UsingtheFlowLayout/UsingtheFlowLayout.html => 위의 문서를 보면 estimatedspacing이랑 실제 그려질때 actual spacing이랑 다른 것을 볼 수 있다 스택오버플로우로 찾아본 결과,,! 밑의 코드로 actual spacing을 확인해볼 수 있다 func calculateActualSpacing()->CGFloat?{ let firstIndex = IndexPath(item: 0, section: 0) let secondIndex = IndexPath(item: 1, se..
일단 나는 Binary Tree랑 Binary Search Tree 랑 늘 헷갈리니까 개념부터 명확히! ( 출처 https://stackoverflow.com/questions/6380231/difference-between-binary-tree-and-binary-search-tree ) 그니까 이진트리는 부모가 왼쪽 자식, 오른쪽 자식 ( 총 두개의 leaf ) 를 가질 수 있는 트리이다이진 탐색트리는 현재 있는 노드보다 작은 값이 왼쪽에, 큰 값이 오른쪽에 있는 이진트리이다 아래와 같은 BST를 구현해보자 // https://www.raywenderlich.com/990-swift-algorithm-club-swift-binary-search-tree-data-structure 참고 12345678..
https://www.raywenderlich.com/5357-what-s-new-in-swift-4-2( WWDC 2018 - What’s New in Swift 4.2 도 있음 근데 한글 자막이 없다... ) 아직 다 안읽어봤지만 가장 마음에 드는 부분은 index(where:) -> firstIndex(where:)index(of:) -> firstIndex(of:) 이렇게 명확하게 이름이 바뀐 것이다 array의 각 아이템에 index(of:) 함수를 쓰면 그 아이템의 인덱스가 나올꺼라고 기대하기 쉽지만 배열에 같은 아이템들이 있다면 맨 앞의 아이템의 인덱스를 반환해줘서 가끔 실수할때가 있었기 때문이다 123456let array = [1,2,3,1,1,1,1,1]array.forEach { pr..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889import Foundation typealias ItemTuple = (name:String,size:Int,value:Int) // 최적의 물건들과 가치를 리턴해준다func getBestItemsAndValue(bagSize:Int,itemTupleArray:[ItemTuple]) -> (Int,String){ //size를 인덱스 겸 진짜 사이즈로 쓰고 싶어서 열을 하나 더 늘림 ..! 0번 열은 안씀..
우선 다익스트라 알고리즘은 - Cycle ( 두 정점이 서로를 향하고 있는 것 ) 이 없는 그래프- Weighted 그래프 ( 그래프의 간선에 가중치를 준 가중 그래프 ) 에서 쓸 수 있다. 하지만 음의 가중치가 있으면 안된다. 만약 음의 가중치를 가진 그래프에서 최단 경로를 찾고 싶으면 벨만 - 포드 알고리즘을 사용하면 된다 가중 그래프에서 X까지의 최단 경로 ( 가장 빠른 경로 ) 를 찾을 수 있는 알고리즘이다. 다익스트라 알고리즘은 4단계로 구성된다 1] 가장 시간이 적게 걸리는 정점 찾기2] 이 정점의 이웃 정점들의 시간을 조사 -> 현재보다 더 적은 시간의 경로가 존재한다면, 시간을 수정3] 그래프 상의 모든 정점에 대해 이러한 일을 반복한다4] 최종경로를 계산한다 [ 예시 ] [ 코드로 구현해..
12345678910111213141516extension String{ func getArrayAfterRegex(regex: String) -> [String] { do { let regex = try NSRegularExpression(pattern: regex) let results = regex.matches(in: self, range: NSRange(self.startIndex..., in: self)) return results.map { String(self[Range($0.range, in: self)!]) } } catch let error { print("invalid regex: \(error.localizedDescription)") return [] } }}Colored by ..
R슬라이더, G슬라이더, B슬라이더가 있고 RGB값에 따라 해당 색깔이 나오는 colorview를 만들어주자 :) 스토리보드에서 슬라이더와 뷰를 뷰컨트롤러에 올려주고 슬라이더의 min값은 0, max값은 1로 설정해주기! 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657import UIKitimport RxCocoaimport RxSwift class ColorViewController: UIViewController { @IBOutlet weak var colorView: UIView! @IBOutlet weak var rLabel: UILabel! @IBOutle..
- Total
- Today
- Yesterday
- Python Type Hint
- PencilKit
- Django Heroku Scheduler
- drf custom error
- Flutter Text Gradient
- Flutter getter setter
- flutter 앱 출시
- flutter build mode
- Watch App for iOS App vs Watch App
- DRF APIException
- METAL
- Django FCM
- cocoapod
- ribs
- 플러터 싱글톤
- 장고 URL querystring
- github actions
- ipad multitasking
- Flutter Clipboard
- Django Firebase Cloud Messaging
- SerializerMethodField
- Sketch 누끼
- 구글 Geocoding API
- Flutter 로딩
- 플러터 얼럿
- 장고 Custom Management Command
- Flutter Spacer
- flutter dynamic link
- Dart Factory
- flutter deep link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |