Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ only_rules:

- shorthand_optional_binding

# Prefer `someBool.toggle()` over `someBool = !someBool`.
- toggle_bool

# Files should have a single trailing newline.
- trailing_newline

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private extension TextFieldTableViewCell {
}

@objc func secureTextEntryToggleAction(_ sender: Any) {
textField.isSecureTextEntry = !textField.isSecureTextEntry
textField.isSecureTextEntry.toggle()

// Save and re-apply the current selection range to save the cursor position
let currentTextRange = textField.selectedTextRange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class SharingButtonsViewController: UITableViewController {
switchCell.onChange = { [weak self] newValue in
guard let self else { return }
WPAnalytics.track(.sharingButtonsEditSharingButtonsToggled, properties: ["checked": newValue as Any], blog: self.blog)
self.buttonsSection.editing = !self.buttonsSection.editing
self.buttonsSection.editing.toggle()
self.updateButtonOrderAfterEditing()
self.reloadButtons()
}
Expand Down Expand Up @@ -452,7 +452,7 @@ class SharingButtonsViewController: UITableViewController {
guard let self else { return }
WPAnalytics.track(.sharingButtonsEditMoreButtonToggled, properties: ["checked": newValue as Any], blog: self.blog)
self.updateButtonOrderAfterEditing()
self.moreSection.editing = !self.moreSection.editing
self.moreSection.editing.toggle()
self.reloadButtons()
}
}
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/ViewRelated/Cells/ExpandableCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ExpandableCell: WPReusableTableViewCell, NibLoadable {
}

public func toggle() {
expanded = !expanded
expanded.toggle()
}

private func setupSubviews() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,10 @@ extension NotificationSettingsViewController {
let section = self.section(at: index.section)
switch section {
case .blog:
displayBlogMoreWasAccepted = !displayBlogMoreWasAccepted
displayBlogMoreWasAccepted.toggle()

case .followedSites:
displayFollowedMoreWasAccepted = !displayFollowedMoreWasAccepted
displayFollowedMoreWasAccepted.toggle()

default:
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class NoteBlockUserTableViewCell: NoteBlockTableViewCell {
if let listener = isFollowOn ? onUnfollowClick : onFollowClick {
listener()
}
isFollowOn = !isFollowOn
isFollowOn.toggle()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class PluginViewModel: Observable {
expandedText: setHTMLTextAttributes(text),
expanded: descriptionExpandedStatus,
action: { [unowned self] row in
self.descriptionExpandedStatus = !self.descriptionExpandedStatus
self.descriptionExpandedStatus.toggle()
(row as? ExpandableRow)?.expanded = self.descriptionExpandedStatus
},
onLinkTap: { [unowned self] url in
Expand All @@ -399,7 +399,7 @@ class PluginViewModel: Observable {
expandedText: setHTMLTextAttributes(text),
expanded: installationExpandedStatus,
action: { [unowned self] row in
self.installationExpandedStatus = !self.installationExpandedStatus
self.installationExpandedStatus.toggle()
(row as? ExpandableRow)?.expanded = self.installationExpandedStatus
},
onLinkTap: { [unowned self] url in
Expand All @@ -415,7 +415,7 @@ class PluginViewModel: Observable {
expandedText: setHTMLTextAttributes(text),
expanded: changeLogExpandedStatus,
action: { [unowned self] row in
self.changeLogExpandedStatus = !self.changeLogExpandedStatus
self.changeLogExpandedStatus.toggle()
(row as? ExpandableRow)?.expanded = self.changeLogExpandedStatus
},
onLinkTap: { [unowned self] url in
Expand All @@ -431,7 +431,7 @@ class PluginViewModel: Observable {
expandedText: setHTMLTextAttributes(text),
expanded: faqExpandedStatus,
action: { [unowned self] row in
self.faqExpandedStatus = !self.faqExpandedStatus
self.faqExpandedStatus.toggle()
(row as? ExpandableRow)?.expanded = self.faqExpandedStatus
},
onLinkTap: { [unowned self] url in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ extension ReaderTopicCollectionViewCoordinator: UICollectionViewDelegateFlowLayo
return
}

layout.isExpanded = !layout.isExpanded
layout.isExpanded.toggle()
layout.invalidateLayout()

WPAnalytics.trackReader(.readerChipsMoreToggled)
Expand Down