Skip to content

Commit

Permalink
Change delegate properties to be unowned
Browse files Browse the repository at this point in the history
To address concerns in #127
  • Loading branch information
bryanjclark committed Jan 14, 2021
1 parent d7c337c commit b7f8bce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions SwiftTweaks/StringOptionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import Foundation
import UIKit

internal protocol StringOptionViewControllerDelegate {
internal protocol StringOptionViewControllerDelegate: class {
func stringOptionViewControllerDidPressDismissButton(_ tweakSelectionViewController: StringOptionViewController)
}

/// Allows the user to select an option for a StringListOption value.
internal class StringOptionViewController: UITableViewController {
fileprivate let tweak: Tweak<StringOption>
fileprivate let tweakStore: TweakStore
fileprivate let delegate: StringOptionViewControllerDelegate
fileprivate unowned var delegate: StringOptionViewControllerDelegate

fileprivate var currentOption: String {
didSet {
Expand Down
4 changes: 2 additions & 2 deletions SwiftTweaks/TweakCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

internal protocol TweakCollectionViewControllerDelegate {
internal protocol TweakCollectionViewControllerDelegate: class {
func tweakCollectionViewControllerDidPressDismissButton(_ tweakCollectionViewController: TweakCollectionViewController)
func tweakCollectionViewController(_ tweakCollectionViewController: TweakCollectionViewController, didTapFloatingTweakGroupButtonForTweakGroup tweakGroup: TweakGroup)
}
Expand All @@ -18,7 +18,7 @@ internal final class TweakCollectionViewController: UIViewController {
fileprivate let tweakCollection: TweakCollection
fileprivate let tweakStore: TweakStore

fileprivate let delegate: TweakCollectionViewControllerDelegate
fileprivate unowned var delegate: TweakCollectionViewControllerDelegate

fileprivate let tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style: .grouped)
Expand Down
4 changes: 2 additions & 2 deletions SwiftTweaks/TweakColorCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

import UIKit

internal protocol TweakColorCellDelegate {
internal protocol TweakColorCellDelegate: class {
func tweakColorCellDidChangeValue(_ cell: TweakColorCell)
}

/// a UITableViewCell that contains a slider & text field for editing a ColorComponent.
internal final class TweakColorCell: UITableViewCell {
internal static let cellHeight: CGFloat = 50

internal var delegate: TweakColorCellDelegate?
internal unowned var delegate: TweakColorCellDelegate?

internal var viewData: ColorComponent? {
didSet {
Expand Down
4 changes: 2 additions & 2 deletions SwiftTweaks/TweakColorEditViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

import UIKit

internal protocol TweakColorEditViewControllerDelegate {
internal protocol TweakColorEditViewControllerDelegate: class {
func tweakColorEditViewControllerDidPressDismissButton(_ tweakColorEditViewController: TweakColorEditViewController)
}

/// A fullscreen color editor with hex, RGBa, and HSBa controls
internal final class TweakColorEditViewController: UIViewController {
private let tweak: Tweak<UIColor>
private let tweakStore: TweakStore
private let delegate: TweakColorEditViewControllerDelegate
private unowned var delegate: TweakColorEditViewControllerDelegate

fileprivate var viewData: ColorRepresentation {
didSet {
Expand Down
5 changes: 2 additions & 3 deletions SwiftTweaks/TweaksCollectionsListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

internal protocol TweaksCollectionsListViewControllerDelegate {
internal protocol TweaksCollectionsListViewControllerDelegate: class {
func tweaksCollectionsListViewControllerDidTapDismissButton(_ tweaksCollectionsListViewController: TweaksCollectionsListViewController)
func tweaksCollectionsListViewControllerDidTapShareButton(_ tweaksCollectionsListViewController: TweaksCollectionsListViewController, shareButton: UIBarButtonItem)
func tweakCollectionListViewController(_ tweakCollectionViewController: TweaksCollectionsListViewController, didTapFloatingTweakGroupButtonForTweakGroup tweakGroup: TweakGroup)
Expand All @@ -19,8 +19,7 @@ internal final class TweaksCollectionsListViewController: UIViewController {
private let tableView: UITableView

fileprivate let tweakStore: TweakStore
fileprivate let delegate: TweaksCollectionsListViewControllerDelegate

fileprivate unowned var delegate: TweaksCollectionsListViewControllerDelegate

// MARK: Init

Expand Down

0 comments on commit b7f8bce

Please sign in to comment.