Skip to content

Instantly share code, notes, and snippets.

View hsleedevelop's full-sized avatar
🔥

HS Lee hsleedevelop

🔥
View GitHub Profile
action ...
Specify one or more actions to perform. Available actions are:
build Build the target in the build root (SYMROOT). This is the default action, and is used if no action is given.
build-for-testing Build the target and associated tests in the build root (SYMROOT). This will also produce an xctestrun file in
the build root. This requires specifying a scheme.
analyze Build and analyze a target or scheme from the build root (SYMROOT). This requires specifying a scheme.
@hsleedevelop
hsleedevelop / findnotusingfiles.txt
Last active May 14, 2019 02:13
find not using files in Xcode project
https://stackoverflow.com/a/52825714/3374327
Assuming your MyProject.xcodeproj is in your working directory, and all your sources are in or below your working directory, you could use a hack* like this to look for .m files that are not part of any target:
find . -name "*.m" -exec basename '{}' \; | xargs -I '{}' sh -c 'grep "{} in Sources" MyProject.xcodeproj/project.pbxproj > /dev/null; echo "$?\c"; echo " {}"' | grep "^1"
Once you remove the files from the project, you can remove them -- and other objc source files that are no longer referenced from your project -- from your git repo using this similar script:
find . -name "*.[hm]" -exec basename '{}' \; | xargs -I '{}' sh -c 'grep {} MyProject.xcodeproj/project.pbxproj > /dev/null; echo "$?\c"; echo " {}"' | grep "^1" | cut -c3- | xargs -I '%' find . -name '%' -exec git rm '{}' \;
* hack in the sense that it depends on implementation details of the Xcode file format.
@hsleedevelop
hsleedevelop / gist:1ceba0d4c039f0e6bdbbf8c904fa9a85
Last active May 8, 2019 10:53
jenkins configuration - build
#source ~/.bash_profile
export FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT=120
export TERM=xterm-256color
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
bundle install
bundle exec pod install --repo-update
1... Why is UIScrollView leaving space on top
With Storyboard- Goto view controller > Attribute Inspector > Uncheck Adjust Scroll View Insets property
With Code- For extra space set viewController property automaticallyAdjustsScrollViewInsets to NO, by default it is YES.
self.automaticallyAdjustsScrollViewInsets = false;
scroller.contentInset = UIEdgeInsetsZero;
scroller.scrollIndicatorInsets = UIEdgeInsetsZero;
scroller.contentOffset = CGPointMake(0.0, 0.0);
@hsleedevelop
hsleedevelop / multipleBindingAtOnce.swift
Last active April 8, 2019 11:08
multiple Binding At Once Example
let binder: (Observable<Bool>) -> Disposable = { obs in
return obs.bind(to: self.tableView.rx.printing)
}
let bindCurry: (Observable<Bool>) -> (Binder<Bool>) -> Observable<Bool> = { obs in
return { binder in
obs.bind(to: binder).disposed(by: self.disposeBag)
return obs
}
}
@hsleedevelop
hsleedevelop / json.swift
Created March 21, 2019 07:45 — forked from chriseidhof/json.swift
Reflection
import Cocoa
struct Person {
var name: String = "John"
var age: Int = 50
var dutch: Bool = false
var address: Address? = Address(street: "Market St.")
}
struct Address {
//캐릭터 변경, 넽 변경 에 따른 홈-전체 리로드
guard let reachabilityObservable = try? DefaultReachabilityService.shared().reachability.asObservable() else {
return
}
Observable.combineLatest(UserDataManager.shared.currentCharacter, reachabilityObservable, viewModel.currentTabEditEvent.startWith(nil))
.distinctUntilChanged({ (lhs, rhs) -> Bool in
return lhs.2 != rhs.2 || lhs.1.reachable != rhs.1.reachable || lhs.0 != rhs.0
})
.map { [weak self] args -> (CharacterType?, ReachabilityStatus, RxTimeInterval) in
@hsleedevelop
hsleedevelop / delaySubscription_example.swift
Last active January 4, 2019 05:25
delay subscription
.flatMapFirst { args -> Observable<(CharacterType?, ReachabilityStatus)> in
let delay = self.editSection == nil ? 0 : 0.75
return Observable.just(args).delaySubscription(RxTimeInterval(delay), scheduler: MainScheduler.instance)
}
@hsleedevelop
hsleedevelop / scroll.swift
Last active December 6, 2018 05:01
Draggin Inifite scroll of Collectionview
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
@hsleedevelop
hsleedevelop / retain.swift
Last active December 5, 2018 05:36
check retain count example
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)
}
})