Skip to content

Commit

Permalink
Update protocol constraint class to AnyObject (microsoft#76)
Browse files Browse the repository at this point in the history
* Replace class with AnyObject

* Remove unnecessary NSObjectProtocol conformance

* Replace class with AnyObject for macOS
  • Loading branch information
li-bei authored May 27, 2020
1 parent 639c131 commit f8727c1
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion ios/FluentUI/Badge Field/BadgeField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
public typealias MSBadgeFieldDelegate = BadgeFieldDelegate

@objc(MSFBadgeFieldDelegate)
public protocol BadgeFieldDelegate: class {
public protocol BadgeFieldDelegate: AnyObject {
@objc optional func badgeField(_ badgeField: BadgeField, badgeDataSourceForText text: String) -> BadgeViewDataSource

@objc optional func badgeField(_ badgeField: BadgeField, willChangeTextFieldContentWithText newText: String)
Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Calendar/CalendarViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import UIKit

// MARK: CalendarViewStyleDataSource

protocol CalendarViewStyleDataSource: class {
protocol CalendarViewStyleDataSource: AnyObject {
func calendarViewDataSource(_ dataSource: CalendarViewDataSource, textStyleForDayWithStart dayStartDate: Date, end: Date, dayStartComponents: DateComponents, todayComponents: DateComponents) -> CalendarViewDayCellTextStyle

// Suggestion: Use provided components for performance improvements. Check where it's called to see what's available
Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Calendar/CalendarViewLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import UIKit

// MARK: CalendarViewLayoutDelegate

protocol CalendarViewLayoutDelegate: class {
protocol CalendarViewLayoutDelegate: AnyObject {
func calendarViewLayout(_ calendarViewLayout: CalendarViewLayout, shouldShowMonthBannerForSectionIndex sectionIndex: Int) -> Bool
}

Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Controls/ScrollView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import UIKit

protocol ContainerView { }

protocol ScrollableContainerView: class {
protocol ScrollableContainerView: AnyObject {
func makeFirstResponderVisible()
}

Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Controls/SearchBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public typealias MSSearchBarDelegate = SearchBarDelegate

/// Various state update methods coming from the SearchBar
@objc(MSFSearchBarDelegate)
public protocol SearchBarDelegate: class, NSObjectProtocol {
public protocol SearchBarDelegate: AnyObject {
func searchBarDidBeginEditing(_ searchBar: SearchBar)
func searchBar(_ searchBar: SearchBar, didUpdateSearchText newSearchText: String?)
@objc optional func searchBarDidFinishEditing(_ searchBar: SearchBar)
Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Controls/TwoLineTitleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
public typealias MSTwoLineTitleViewDelegate = TwoLineTitleViewDelegate

@objc(MSFTwoLineTitleViewDelegate)
public protocol TwoLineTitleViewDelegate: class {
public protocol TwoLineTitleViewDelegate: AnyObject {
func twoLineTitleViewDidTapOnTitle(_ twoLineTitleView: TwoLineTitleView)
}

Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Core/Obscurable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import UIKit

/// Obscurable represents any UIView containing class that obscures views behind it. It is used to generically use different styles of background obscuring for modals, as well as provide an interface to turn their effect on or off.
protocol Obscurable: class {
protocol Obscurable: AnyObject {
var view: UIView { get }
var isObscuring: Bool { get set }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum DateTimePickerViewMode {

// MARK: - DateTimePickerViewDelegate

protocol DateTimePickerViewDelegate: class {
protocol DateTimePickerViewDelegate: AnyObject {
func dateTimePickerView(_ dateTimePickerView: DateTimePickerView, accessibilityValueOverwriteForDate date: Date, originalValue: String?) -> String?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import UIKit

// MARK: DateTimePickerViewComponentDelegate

protocol DateTimePickerViewComponentDelegate: class {
protocol DateTimePickerViewComponentDelegate: AnyObject {
func dateTimePickerComponentDidScroll(_ component: DateTimePickerViewComponent, userInitiated: Bool)
func dateTimePickerComponent(_ component: DateTimePickerViewComponent, didSelectItemAtIndexPath indexPath: IndexPath, userInitiated: Bool)
func dateTimePickerComponent(_ component: DateTimePickerViewComponent, accessibilityValueForDateComponents dateComponents: DateComponents?, originalValue: String?) -> String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum DateTimePickerViewAMPM {
* DataSource of a component of DateTimePickerView. All dataSources must follow this protocol and be private to this file.
* Use the factory to instantiate the specific dataSources based on a type. (should be used only by DateTimePickerView and not used or instantiated on its own)
*/
protocol DateTimePickerViewDataSource: class {
protocol DateTimePickerViewDataSource: AnyObject {
func numberOfItems() -> Int

// If the item is present multiple times, return the indexPath at the center
Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Date Time Pickers/DateTimePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum DateTimePickerMode: Int {
public typealias MSDateTimePickerDelegate = DateTimePickerDelegate

@objc(MSFDateTimePickerDelegate)
public protocol DateTimePickerDelegate: class {
public protocol DateTimePickerDelegate: AnyObject {
/// Allows a class to be notified when a user confirms their selected date
func dateTimePicker(_ dateTimePicker: DateTimePicker, didPickStartDate startDate: Date, endDate: Date)
/// Allows for some validation and cancellation of picking behavior, including the dismissal of DateTimePicker classes when Done is pressed. If false is returned, the dismissal and `didPickStartDate` delegate calls will not occur. This is not called when dismissing the modal without selection, such as when tapping outside to dismiss.
Expand Down
4 changes: 2 additions & 2 deletions ios/FluentUI/Date Time Pickers/GenericDateTimePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import UIKit

// MARK: GenericDateTimePicker

protocol GenericDateTimePicker: class {
protocol GenericDateTimePicker: AnyObject {
var startDate: Date { get set }
var endDate: Date { get set }
var delegate: GenericDateTimePickerDelegate? { get set }
Expand All @@ -24,7 +24,7 @@ extension GenericDateTimePicker where Self: UIViewController {

// MARK: - GenericDateTimePickerDelegate

protocol GenericDateTimePickerDelegate: class {
protocol GenericDateTimePickerDelegate: AnyObject {
func dateTimePicker(_ dateTimePicker: GenericDateTimePicker, didPickStartDate startDate: Date, endDate: Date)
func dateTimePicker(_ dateTimePicker: GenericDateTimePicker, didSelectStartDate startDate: Date, endDate: Date)
func dateTimePicker(_ dateTimePicker: GenericDateTimePicker, shouldEndPickingStartDate startDate: Date, endDate: Date) -> Bool
Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Drawer/DrawerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public enum DrawerPresentationBackground: Int {
public typealias MSDrawerControllerDelegate = DrawerControllerDelegate

@objc(MSFDrawerControllerDelegate)
public protocol DrawerControllerDelegate: class {
public protocol DrawerControllerDelegate: AnyObject {
/**
Called when a user resizes the drawer enough to change its expanded state. Use `isExpanded` property to get the current state.

Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/HUD/HUD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
public typealias MSHUDDelegate = HUDDelegate

@objc(MSFHUDDelegate)
public protocol HUDDelegate: class {
public protocol HUDDelegate: AnyObject {
func defaultWindowForHUD(_ hud: HUD) -> UIWindow?
}

Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Presenters/PageCardPresenterController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import UIKit

protocol CardPresentable: class {
protocol CardPresentable: AnyObject {
func idealSize() -> CGSize
}

Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Table View/TableViewHeaderFooterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
public typealias MSTableViewHeaderFooterViewDelegate = TableViewHeaderFooterViewDelegate

@objc(MSFTableViewHeaderFooterViewDelegate)
public protocol TableViewHeaderFooterViewDelegate: class {
public protocol TableViewHeaderFooterViewDelegate: AnyObject {
/// Returns: true if the interaction with the header view should be allowed; false if the interaction should not be allowed.
@objc optional func headerFooterView(_ headerFooterView: TableViewHeaderFooterView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool
}
Expand Down
2 changes: 1 addition & 1 deletion ios/FluentUI/Utilities/AnimationSynchronizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public typealias MSAnimationSynchronizerProtocol = AnimationSynchronizerProtocol
/// An animation synchronizer syncs homogeneous layer animations by calculating the appropriate timeOffset
/// of a referenceLayer so that newly added animations can stay in sync with existing animations.
@objc(MSFAnimationSynchronizerProtocol)
public protocol AnimationSynchronizerProtocol: class {
public protocol AnimationSynchronizerProtocol: AnyObject {
/// Current reference layer to compare timing against.
@objc var referenceLayer: CALayer? { get set }

Expand Down
2 changes: 1 addition & 1 deletion macos/FluentUI/DatePicker/CalendarHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class CalendarHeaderView: NSView {
}
}

protocol CalendarHeaderViewDelegate: class {
protocol CalendarHeaderViewDelegate: AnyObject {

/// Tells the delegate that the leading arrow button was pressed.
///
Expand Down
2 changes: 1 addition & 1 deletion macos/FluentUI/DatePicker/CalendarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CalendarView: NSView {
}
}

protocol CalendarViewDelegate: class {
protocol CalendarViewDelegate: AnyObject {

/// Tells the delegate that a date was selected.
///
Expand Down
2 changes: 1 addition & 1 deletion macos/FluentUI/DatePicker/DatePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ extension Calendar {
}

@objc(MSFDatePickerControllerDelegate)
public protocol DatePickerControllerDelegate : class {
public protocol DatePickerControllerDelegate : AnyObject {

/// Tells the delegate that a new date was selected.
///
Expand Down
4 changes: 2 additions & 2 deletions macos/FluentUI/DatePicker/DatePickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ extension DatePickerView: CalendarHeaderViewDelegate {
}
}

protocol DatePickerViewDelegate: class {
protocol DatePickerViewDelegate: AnyObject {

/// Tells the delegate that a new date was selected.
///
Expand Down Expand Up @@ -462,7 +462,7 @@ extension DatePickerViewDelegate {
}
}

protocol DatePickerViewDataSource: class {
protocol DatePickerViewDataSource: AnyObject {

/// Currently selected date
var selectedDate: Date { get }
Expand Down

0 comments on commit f8727c1

Please sign in to comment.