I hereby claim:
- I am davewoodcom on github.
- I am davewood (https://keybase.io/davewood) on keybase.
- I have a public key ASDVQq_MleuhYXva8i4Zs2Tt4yIJbtJx15W15Wd_Mx5Yfgo
To claim this, I am signing this object:
// | |
// TestProjectTests.swift | |
// Tests | |
// | |
// Based on a question Nick Lockwood asked on Twitter: https://twitter.com/nicklockwood/status/1146508387498303488 . | |
// And then followed up by GeekAndDad https://twitter.com/GeekAndDad/status/1146630469842116609 . | |
// These tests were executed on an iMac 5k, against an iOS project running in the XR Simulator. | |
// My results are included as comments in each test below. I ran the tests 5 times (which itself runs each test 10 times). | |
// The average of each 10 runs are listed below, as well as the placing 1st/2nd/3rd for each of the 3 styles. |
Here's some sample code that works fine in Xcode 10.1, but fails to compile in 10.2 even though it's valid code. | |
The #if/#else/#endif code seems to be confusing the compiler and thus it is mixing up scope. | |
Xcode Version 10.2 (10E125) -> Broken | |
Xcode Version 10.1 (10B61) -> Works correctly |
post_install do |installer| | |
print "Setting the default SWIFT_VERSION to 4.0\n" | |
installer.pods_project.build_configurations.each do |config| | |
config.build_settings['SWIFT_VERSION'] = '4.0' | |
end | |
installer.pods_project.targets.each do |target| | |
if ['SomeTarget-iOS', 'SomeTarget-watchOS'].include? "#{target}" | |
print "Setting #{target}'s SWIFT_VERSION to 3.0\n" | |
target.build_configurations.each do |config| |
extension String { | |
func isValidEmail() -> Bool { | |
guard !self.lowercaseString.hasPrefix("mailto:") else { return false } | |
guard let emailDetector = try? NSDataDetector(types: NSTextCheckingType.Link.rawValue) else { return false } | |
let matches = emailDetector.matchesInString(self, options: NSMatchingOptions.Anchored, range: NSRange(location: 0, length: self.characters.count)) | |
guard matches.count == 1 else { return false } | |
return matches[0].URL?.scheme == "mailto" | |
} | |
} |
#!/bin/bash | |
## Copyright (C) 2015 Cerebral Gardens http://www.cerebralgardens.com/ | |
## | |
## Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
## software and associated documentation files (the "Software"), to deal in the Software | |
## without restriction, including without limitation the rights to use, copy, modify, | |
## merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
## permit persons to whom the Software is furnished to do so, subject to the following | |
## conditions: |
extension XCGLogger { | |
public class XCGTextViewLogDestination: XCGLogDestinationProtocol, DebugPrintable { | |
public var owner: XCGLogger | |
public var identifier: String | |
public var outputLogLevel: XCGLogger.LogLevel = .Debug | |
public var showThreadName: Bool = false | |
public var showFileName: Bool = true | |
public var showLineNumber: Bool = true |
I hereby claim:
To claim this, I am signing this object:
public extension Optional { | |
public var exists: Bool { | |
return (self != nil) | |
} | |
public var notExists: Bool { | |
return (self == nil) | |
} | |
} |
// | |
// UIViewController+Alerts.h | |
// | |
// Created by Dave Wood on 2012-01-17. | |
// | |
// Simplified BSD License | |
// Copyright (c) 2012, Cerebral Gardens | |
// All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without |