Skip to content

Commit

Permalink
Merge pull request twostraws#244 from byaruhaf/IfLet
Browse files Browse the repository at this point in the history
Replacing if let & guard let in Swift 5.7
  • Loading branch information
twostraws authored Sep 30, 2022
2 parents c84a154 + 17bf349 commit 3ea8c77
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Unwrap/Activities/Home/BadgeCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BadgeCollectionViewCell: UICollectionViewCell {

var badge: Badge? {
didSet {
guard let badge = badge else {
guard let badge else {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SpotTheErrorDataSource: NSObject, UITableViewDataSource, UITableViewDelega
cell.textLabel?.attributedText = practiceData.code[indexPath.row].syntaxHighlighted()
cell.textLabel?.font = Unwrap.codeFont

if let selectedAnswer = selectedAnswer, isShowingAnswers == true {
if let selectedAnswer, isShowingAnswers == true {
cell.textLabel?.textColor = .white

if indexPath.row == selectedAnswer {
Expand Down
2 changes: 1 addition & 1 deletion Unwrap/Activities/Welcome/TourItemViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TourItemViewController: UIViewController, Storyboarded {
override func viewDidLoad() {
super.viewDidLoad()

guard let item = item else {
guard let item else {
fatalError("Attempted to create a TourItemViewController with no tour item.")
}

Expand Down
2 changes: 1 addition & 1 deletion Unwrap/Reusables/AlertViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AlertViewController: UIViewController, Storyboarded {

/// Called when the OK button was tapped. If we have a coordinator let it decide what should happen; if not, just dismiss the alert.
@IBAction func continueTapped(_ sender: Any) {
if let coordinator = coordinator {
if let coordinator {
coordinator.alertDismissed(type: alertType)
} else {
// we don't have a coordinator – just dismiss
Expand Down

0 comments on commit 3ea8c77

Please sign in to comment.