git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.
diskutil list | |
diskutil unmount /dev/disk0s6 | |
sudo mount -w -t msdos /dev/disk0s6 /Volumes/data |
How To sysdiagnose on iOS:
extension UIView { | |
@objc func exerciseAmbiguityInLayoutRepeatedly() { | |
if self.hasAmbiguousLayout { | |
Timer.scheduledTimer(timeInterval: 0.5, | |
target: self, | |
selector: #selector(UIView.exerciseAmbiguityInLayout), | |
userInfo: nil, | |
repeats: true) | |
} | |
} |
Greetings, NSHipsters!
As we prepare to increment our NSDateComponents -year
by 1
, it's time once again for NSHipster end-of-the-year Reader Submissions! Last year, we got some mind-blowing tips and tricks. With the release of iOS 7 & Mavericks, and a year's worth of new developments in the Objective-C ecosystem, there should be a ton of new stuff to write up for this year.
Submit your favorite piece of Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!
Here are a few examples of the kind of things I'd like to see:
NSStringFromSelector(@selector())
as a safer way to do KVC / KVO / NSCoding.import Foundation | |
import Combine | |
enum APIError: Error, LocalizedError { | |
case unknown, apiError(reason: String) | |
var errorDescription: String? { | |
switch self { | |
case .unknown: | |
return "Unknown error" |
extension String { | |
func getRawVersionString() -> String? { | |
return self.removePrefix("v") | |
.split(separator: "-") | |
.first?.toString() | |
} | |
// Modified from the DragonCherry extension - https://github.com/DragonCherry/VersionCompare | |
private func compare(toVersion targetVersion: String) -> ComparisonResult { | |
let versionDelimiter = "." |
import Foundation | |
protocol NetworkLoader { | |
func loadData(using request: URLRequest, with completion: @escaping (Data?, HTTPURLResponse?, Error?) -> Void) | |
} | |
extension URLSession: NetworkLoader { | |
/// Asyncronously load data using a URL Request | |
/// - Parameters: | |
/// - request: an unwrapped URLRequest |
import UIKit | |
class OnboardingManager { | |
private let userDefaults: UserDefaults | |
init(userDefaults: UserDefaults = .standard) { | |
self.userDefaults = userDefaults | |
} | |
func presentOnboardingControllerIfNeeded(in viewController: UIViewController) { |