It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
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
// Douglas Hill, December 2018 | |
// Made for https://douglashill.co/reading-app/ | |
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit | |
import UIKit | |
/// A table view that allows navigation and selection using a hardware keyboard. | |
/// Only supports a single section. | |
class KeyboardTableView: UITableView { | |
// These properties may be set or overridden to provide discoverability titles for key commands. |
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 Number /* class cluser */ { | |
class Int8: Number { | |
var value: Swift.Int8 | |
init(_ value: Swift.Int8) { self.value = value } | |
} | |
class Int: Number { | |
var value: Swift.Int | |
init(_ value: Swift.Int) { self.value = value } | |
} |
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
func modifiedCopy<Struct, Arg>(start: Struct, @noescape mutator: (inout Struct) -> Arg -> (), arg: Arg) -> Struct { | |
var new = start | |
mutator(&new)(arg) | |
return new | |
} | |
extension Array { | |
func arrayByAppending(e: Element) -> Array { | |
return modifiedCopy(self, mutator: Array.append, arg: e) |
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
#!/usr/bin/swift | |
import Foundation | |
func scanForRepositories(directory: NSURL, root: NSURL) { | |
let fileManager = NSFileManager.defaultManager() | |
let options: NSDirectoryEnumerationOptions = .SkipsSubdirectoryDescendants | .SkipsPackageDescendants | |
if let contents = fileManager.contentsOfDirectoryAtURL(directory, includingPropertiesForKeys: [NSURLIsDirectoryKey], options: options, error: nil) { | |
let urls = contents as Array<NSURL> |
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
// | |
// Free.swift | |
// Swift_Extras | |
// | |
// Created by Robert Widmann on 9/19/14. | |
// Copyright (c) 2014 Robert Widmann. All rights reserved. | |
// | |
import Foundation |
Conversion Process from Objective-C syntax to Swift The most important first step is to run Apple's "Convert to Modern Objective-C Syntax" refactoring, so that you're using array/dictionary literals and bracket-accesses; these will then be usable in Swift. Note also that I'm a beginner in Swift, so my apologies for any mistakes or incompleteness here.
When you see this pattern | Replace with this |
---|---|
Module | |
@interface *newType* : *superType* <*protocol1*, *protocol2*> |
class *newType* : *superType*, *protocol1*, *protocol2* |
@implementation OR @synthesize OR @end |
Delete |
Properties |
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
You can get a refund for any app on the App Store by following this process: | |
1. Visit https://reportaproblem.apple.com | |
2. Sign In with your Apple ID. | |
3. Click “Report a Problem” on the offending app. | |
4. Choose “Problem is not listed here” and be sure to mention that you are asking for a refund because it doesn’t work as expected. |
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
// Property Nonatomic Strong | |
// Platform: All | |
// Completion Scopes: ClassInterfaceMethods | |
@property (nonatomic, strong) <# class_name #> *<# variable_name #>; |
NewerOlder