View BadgeBar.swift
This file contains 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
import UIKit | |
public class BadgeBarButtonItem: UIBarButtonItem { | |
@IBInspectable | |
public var badgeNumber: Int = 0 { | |
didSet { | |
self.updateBadge() | |
} | |
} | |
View ~=.swift
This file contains 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
print(0..<200 ~= 159) // true | |
print(0..<200 ~= 201) // false |
View resetUserDefault.swift
This file contains 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
let domain = Bundle.main.bundleIdentifier! | |
UserDefaults.standard.removePersistentDomain(forName: domain) |
View resetStandardUserDefaults.swift
This file contains 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
UserDefaults.resetStandardUserDefaults() |
View toggle.swift
This file contains 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
var isLike = false | |
if isLike { | |
fetchDisLikeAPI() | |
} else { | |
fetchLikeAPI() | |
} | |
isLike.toggle() |
View isLikeExample.swift
This file contains 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
var isLike = false | |
if isLike { | |
fetchDisLikeAPI() | |
} else { | |
fetchLikeAPI() | |
} | |
isLike = !isLike |
View CompletionClosureNil.swift
This file contains 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 MyCalss { | |
var resultHandler: CompletionClosure = nil | |
} |
View CompletionClosureSample.swift
This file contains 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 MyCalss { | |
var resultHandler: CompletionClosure | |
} |
View CompletionClosure.swift
This file contains 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
typealias CompletionClosure = (() -> ())? |
View TextViewRemovePaddingExtension.swift
This file contains 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
extension UITextView { | |
func removeTextPadding() { | |
textContainer.lineFragmentPadding = 0 | |
textContainerInset = .zero | |
} | |
} |
NewerOlder