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
| func scrollFromDragging() {//need pageEnabled. | |
| guard let scrollView = self.collectionView else { return } | |
| var index = Int((scrollView.contentOffset.x) / (scrollView.frame.width)) | |
| guard currentIndex != index, let banners = banners, rolling == false, isDragging == true else { | |
| return | |
| } | |
| var condition = currentIndex < 0 ? 0 : 3 | |
| condition = index == 0 && currentIndex >= 0 ? 1 : condition |
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
| dataSource.dataReloaded | |
| .filter { [dataSource, tableView] in dataSource?.sectionModels.first?.items.isEmpty == false && tableView?.isEditing == false} | |
| .debug(">>>>>>>>>>> CFGetRetainCount >> \(CFGetRetainCount(self))") | |
| .emit(onNext: { [weak self] _ in | |
| guard let self = self, let items = self.dataSource.sectionModels.first?.items else { return } | |
| if self.viewModel.currentPage.page == 1, items.count <= 50 {//라이크 이벤트 발생 시 최상위로 이동 | |
| self.needScrollToTop = false | |
| self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: UITableViewScrollPosition.top, animated: false) | |
| } | |
| }) |
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
| func infinateLoop(scrollView: UIScrollView) { | |
| var index = Int((scrollView.contentOffset.x)/(scrollView.frame.width)) | |
| guard currentIndex != index, let banners = banners else { | |
| //currentIndex = index | |
| return | |
| } | |
| currentIndex = index | |
| if index <= 0 { | |
| index = banners.count - 1 | |
| let adjust = isDragging ? 1 : 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
| func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { | |
| guard self.topSectionViewTopConstraint.constant > 0 else { return } | |
| let tableViewOffset = tableViewTopEdgeInset + scrollView.contentOffset.y | |
| let topSectionViewTop = tableViewTopEdgeInset - listHeaderView.dimViewHeight | |
| //-160 ~ 0 | |
| var offset = (topSectionViewTop - tableViewOffset) | |
| offset = offset > topSectionViewTop / 2.c ? -tableViewTopEdgeInset : -listHeaderView.dimViewHeight.c | |
| targetContentOffset.pointee.y = offset |
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
| //validate tpo cell in visible cells, | |
| guard let tableView = self.superview as? UITableView, let ip = self.indexPath, tableView.indexPathsForVisibleRows?.contains(ip) == true else { | |
| return | |
| } |
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
| class AlignTopCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
| var sectionLayout: HomeSectionLayout? | |
| override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { | |
| let attrs = super.layoutAttributesForElements(in: rect) | |
| var attrsCopy = [UICollectionViewLayoutAttributes]() | |
| let layout = sectionLayout ?? .PERSONAL | |
| for element in attrs! { |
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
| enum DateError: String, Error { | |
| case invalidDate | |
| } | |
| struct Spaceship : Codable { | |
| var name: String | |
| var createdAt: Date | |
| } | |
| let decoder = JSONDecoder() |
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
| // create results array | |
| __block NSMutableArray* results = [NSMutableArray new]; | |
| // create serial queue | |
| dispatch_queue_t queue = dispatch_queue_create("myQueue", 0); | |
| for(NSInteger i = 0; i < 10; i++) { | |
| // enqueue operation in queue | |
| dispatch_async(queue, ^{ | |
| // create semaphore |
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
| ACTION = build | |
| AD_HOC_CODE_SIGNING_ALLOWED = NO | |
| ALTERNATE_GROUP = staff | |
| ALTERNATE_MODE = u+w,go-w,a+rX | |
| ALTERNATE_OWNER = grantdavis | |
| ALWAYS_SEARCH_USER_PATHS = NO | |
| ALWAYS_USE_SEPARATE_HEADERMAPS = YES | |
| APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer | |
| APPLE_INTERNAL_DIR = /AppleInternal | |
| APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation |
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
| if #available(iOS 11.0, *) { | |
| let bottomPadding = view.safeAreaInsets.bottom | |
| } |