Skip to content

Instantly share code, notes, and snippets.

yohei sugigami susieyy

Block or report user

Report or block susieyy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@susieyy
susieyy / swagger-codegen-config-help.sh
Created Sep 6, 2017
swagger-codegen config-help swift
View swagger-codegen-config-help.sh
java -jar ./swagger-codegen-cli.jar config-help -l swift
CONFIG OPTIONS
sortParamsByRequiredFlag
Sort method arguments to place required parameters before optional parameters. (Default: true)
ensureUniqueParams
Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true)
allowUnicodeIdentifiers
@susieyy
susieyy / PushTransitionWithCustomAnimation.swift
Created Feb 23, 2017
push transition with custom animation
View PushTransitionWithCustomAnimation.swift
let transition = CATransition()
transition.duration = 0.2
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
transition.type = kCATransitionFade
navigationController?.view.layer.addAnimation(transition, forKey: nil)
navigationController?.pushViewController(con, animated: true)
View OverridedCell.swift
final class OverridedCell: UITableViewCell {
static let identifier = "OverridedCell"
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
prepareView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
View InitializableVIewController.swift
final class SearchContainerViewController: UIViewController {
let hoge: Hoge
convenience init(hoge: Hoge) {
self.init(nibName: nil, bundle: nil)
self.hoge = hoge
}
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) { super.init(nibName: nil, bundle: nil) }
required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
View SwipeContainerViewController.swift
final class SwipeContainerViewController: UIPageViewController {
convenience init() {
self.init(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)
}
override init(transitionStyle style: UIPageViewControllerTransitionStyle, navigationOrientation: UIPageViewControllerNavigationOrientation, options: [String : AnyObject]?) {
super.init(transitionStyle: style, navigationOrientation: navigationOrientation, options: options)
}
@susieyy
susieyy / SeparatorInset.swift
Created Aug 9, 2016
UITableView's separator inset
View SeparatorInset.swift
// Hide
cell.separatorInset = UIEdgeInsets(top: 0, left: tableView.bounds.width, bottom: 0, right: 0)
cell.layoutMargins = UIEdgeInsetsZero
// Show
cell.separatorInset = UIEdgeInsetsZero
cell.layoutMargins = UIEdgeInsetsZero
@susieyy
susieyy / PreviousViewController.swift
Created Aug 4, 2016
Access previous view controller in navigation stack
View PreviousViewController.swift
extension UIViewController {
var previousViewController: UIViewController? {
guard let navigationController = navigationController else { return nil }
let count = navigationController.viewControllers.count
return count < 2 ? nil : navigationController.viewControllers[count - 2]
}
}
@susieyy
susieyy / Check_if_view_controller_is_presented_modally__or_pushed_on_a_navigation_stack.swift
Last active Aug 3, 2016
Check if view controller is presented modally, or pushed on a navigation stack
View Check_if_view_controller_is_presented_modally__or_pushed_on_a_navigation_stack.swift
// @see http://stackoverflow.com/a/23620428/1002412
// @see http://level49.com/119
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
if isBeingDismissed() {
// being dismissed
} else if isMovingFromParentViewController() {
// being poped
} else {
@susieyy
susieyy / 0_reuse_code.js
Created Jul 31, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@susieyy
susieyy / swift
Created Jun 17, 2016
Avoid awkward image animation with re-calculated height
View swift
UIView.setAnimationsEnabled(false)
self?.beginUpdates()
self?.endUpdates()
UIView.setAnimationsEnabled(true)
You can’t perform that action at this time.