Skip to content

Instantly share code, notes, and snippets.

import UIKit
import RxSwift
import RxCocoa
final class LoadingBarButton {
fileprivate weak var navigationItem: UINavigationItem?
fileprivate var initialBarButton: UIBarButtonItem?
init(navigationItem: UINavigationItem) {
@NikAshanin
NikAshanin / CopyPasteDetection
Created April 14, 2017 19:01
CopyPasteDetection
# Running CPD
pmd cpd --files ${EXECUTABLE_NAME} --minimum-tokens 50 --language swift --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > cpd-output.xml --failOnViolation true
# Running script
php ./common_strings/cpd_script.php -cpd-xml cpd-output.xml
class SpringyFlowLayout: ChatCollectionViewLayout {
var dynamicAnimator: UIDynamicAnimator?
override func prepareLayout() {
super.prepareLayout()
if dynamicAnimator != nil {
return
}
let frame = CGRect(x: 0, y: 0, width: 1, height: 1)
var options = [UNNotificationAttachmentOptionsThumbnailClippingRectKey: frame]
enum ImageUploadType: String {
case UserBlogPhoto = "userBlogPhoto" // 240x135 pixels
case CarJournalPhoto = "carJournalPhoto" // 240x135 pixels
case MessengerImage = "messengerImage" // 240x135 pixels
case CarPhoto = "carPhoto" // 480x270 pixels
}
class ImageUploadRequest {
class func post(imageFile: UIImage, type: ImageUploadType, success: ((ApiResponse) -> Void)?,
final class ChatSettingsViewModel {
var titleSection: Int = 0
var creatorSection: Int?
var memberSection: Int?
var observerSection: Int?
var numberOfSections: Int?
init(type: SettingsType) {
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let shortPath = (indexPath.section, indexPath.row)
switch shortPath {
case (settingsModel.titleSection, _):
return chatTitleCell(indexPath)
case (settingsModel.creatorSection!, _):
return memberCell(indexPath, type: .Creator)
case (settingsModel.memberSection!, 0):