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 | |
class CustomTableViewCell: UITableViewCell { | |
@IBOutlet weak var wikiImageView: UIImageView! | |
@IBOutlet weak var titleLabel: UILabel! | |
@IBOutlet weak var descriptionLabel: UILabel! | |
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 Foundation | |
import SwiftyJSON | |
import Alamofire | |
enum NetworkError: Error { | |
case failure | |
case success | |
} | |
class APIRequestFetcher { |
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 | |
import SwiftyJSON | |
import Alamofire | |
import SafariServices | |
final class SearchResultsTableViewController: UITableViewController { | |
private var searchResults = [JSON]() { | |
didSet { | |
tableView.reloadData() |
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
#!/bin/sh | |
RSROOT=$SRCROOT/CleanAssetsManagementDemo/Resources | |
"$PODS_ROOT/SwiftGen/bin/swiftgen" \ | |
xcassets -t swift3 "$RSROOT/Assets.xcassets" \ | |
--output "$RSROOT/Assets.swift" | |
"$PODS_ROOT/SwiftGen/bin/swiftgen" \ |
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
switch(expression){ | |
case constant-expression : | |
statement(s); | |
break; /* optional */ | |
case constant-expression : | |
statement(s); | |
break; /* optional */ | |
/* you can have any number of case statements */ | |
default : /* Optional */ |
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 integer = 3 | |
switch integer { | |
case 4: | |
print("Four.") | |
fallthrough | |
case 3: | |
print("Three.") | |
fallthrough | |
case 2: | |
print("Two.") |
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
switch expression { | |
case expression1: | |
statement(s) | |
fallthrough /* optional */ | |
case expression2, expression3: /* we can use , to use same implementation for more than one case */ | |
statement(s) | |
fallthrough /* optional */ | |
default : /* Optional */ | |
statement(s); | |
} |
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
switch userNotificationsAuthorizationStatus { | |
case .notDetermined: | |
requestPermission() | |
case .authorized, .denied, .provisional: | |
fallthrough | |
@unknown default: | |
// No need to request permission. | |
print("Didn't request permission for User Notifications") | |
} |
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
public extension Array { | |
func slice(_ from: Int, count: Int) -> ArraySlice<Element>? { | |
guard (0 <= from && from < self.count) && (from < from+count && from+count < self.count) else { | |
return nil | |
} | |
return self[from...from+count-1] | |
} | |
} |
OlderNewer