Skip to content

Commit

Permalink
Add ListItem to podspec (#2048)
Browse files Browse the repository at this point in the history
* Add ListItem to podspec, move table view/list item shared resources into a separate folder/subspec

* Update dependency

* Alphabetize folders
  • Loading branch information
lyzhan7 committed Jun 21, 2024
1 parent 744a205 commit 2d1071a
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 88 deletions.
16 changes: 16 additions & 0 deletions MicrosoftFluentUI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ fi', :execution_position => :before_compile }
label_ios.source_files = ["ios/FluentUI/Label/**/*.{swift,h}"]
end

s.subspec 'ListItem_ios' do |listitem_ios|
listitem_ios.platform = :ios
listitem_ios.dependency 'MicrosoftFluentUI/OtherCells_ios'
listitem_ios.dependency 'MicrosoftFluentUI/Separator_ios'
listitem_ios.dependency 'MicrosoftFluentUI/TableViewListShared_ios'
listitem_ios.source_files = ["ios/FluentUI/List/**/*.swift"]
end

s.subspec 'MultilineCommandBar_ios' do |multilinecommandbar_ios|
multilinecommandbar_ios.platform = :ios
multilinecommandbar_ios.dependency 'MicrosoftFluentUI/BottomSheet_ios'
Expand Down Expand Up @@ -302,10 +310,18 @@ fi', :execution_position => :before_compile }
tableview_ios.platform = :ios
tableview_ios.dependency 'MicrosoftFluentUI/Label_ios'
tableview_ios.dependency 'MicrosoftFluentUI/Separator_ios'
tableview_ios.dependency 'MicrosoftFluentUI/TableViewListShared_ios'
tableview_ios.preserve_paths = ["ios/FluentUI/Table View/TableView.resources.xcfilelist"]
tableview_ios.source_files = ["ios/FluentUI/Table View/**/*.{swift,h}"]
end

s.subspec 'TableViewListShared_ios' do |tableviewlistshared_ios|
tableviewlistshared_ios.platform = :ios
tableviewlistshared_ios.dependency 'MicrosoftFluentUI/Core_ios'
tableviewlistshared_ios.preserve_paths = ["ios/FluentUI/TableViewListShared/TableViewListShared.resources.xcfilelist"]
tableviewlistshared_ios.source_files = ["ios/FluentUI/TableViewListShared/**/*.{swift,h}"]
end

s.subspec 'TextField_ios' do |textfield_ios|
textfield_ios.platform = :ios
textfield_ios.dependency 'MicrosoftFluentUI/Button_ios'
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ let package = Package(
"Other Cells/OtherCells.resources.xcfilelist",
"Resources/Localization/CultureMapping.json",
"Table View/TableView.resources.xcfilelist",
"TableViewListShared/TableViewListShared.resources.xcfilelist",
"TextField/TextField.resources.xcfilelist",
"Tooltip/Tooltip.resources.xcfilelist",
"TwoLineTitleView/TwoLineTitleView.resources.xcfilelist",
Expand Down
16 changes: 12 additions & 4 deletions ios/FluentUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
0A84A6F029EDC489005DBC3D /* SeparatorTokenSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A84A6EF29EDC489005DBC3D /* SeparatorTokenSet.swift */; };
0A8E61FB291DC11F009E412D /* CommandBarTokenSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8E61FA291DC11F009E412D /* CommandBarTokenSet.swift */; };
0AE3041D29F721B2003CDDD9 /* TableViewHeaderFooterViewTokenSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE3041C29F721B2003CDDD9 /* TableViewHeaderFooterViewTokenSet.swift */; };
2A9745DE281733D700E1A1FD /* TableViewCellTokenSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9745DD281733D700E1A1FD /* TableViewCellTokenSet.swift */; };
3A9FC0F52A6AFAD40060A6BE /* BadgeFieldTokenSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9FC0F42A6AFAD40060A6BE /* BadgeFieldTokenSet.swift */; };
3A9FC0F72A705C090060A6BE /* PeoplePickerTokenSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9FC0F62A705C090060A6BE /* PeoplePickerTokenSet.swift */; };
3AFB0FD629C1365600FEC1A9 /* MultilineCommandBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AFB0FD529C1365600FEC1A9 /* MultilineCommandBar.swift */; };
Expand Down Expand Up @@ -242,6 +241,7 @@
F3DFD3612A7B210100014C6E /* ListActionItemModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3DFD3602A7B210100014C6E /* ListActionItemModifiers.swift */; };
F3F113892A705AD500DA852A /* ListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3F113882A705AD500DA852A /* ListItem.swift */; };
F3F1138D2A705B6900DA852A /* ListItemModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3F1138C2A705B6900DA852A /* ListItemModifiers.swift */; };
F5854ED12C220AC100938291 /* TableViewCellTokenSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5854ECF2C220AC100938291 /* TableViewCellTokenSet.swift */; };
FD053A352224CA33009B6378 /* DatePickerControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD053A342224CA33009B6378 /* DatePickerControllerTests.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -277,7 +277,6 @@
1168630222E131CF0088B302 /* TabBarItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarItemView.swift; sourceTree = "<group>"; };
1168630322E131CF0088B302 /* TabBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarView.swift; sourceTree = "<group>"; };
118D9847230BBA2300BC0B72 /* TabBarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarItem.swift; sourceTree = "<group>"; };
2A9745DD281733D700E1A1FD /* TableViewCellTokenSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewCellTokenSet.swift; sourceTree = "<group>"; };
3A9FC0F42A6AFAD40060A6BE /* BadgeFieldTokenSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeFieldTokenSet.swift; sourceTree = "<group>"; };
3A9FC0F62A705C090060A6BE /* PeoplePickerTokenSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeoplePickerTokenSet.swift; sourceTree = "<group>"; };
3AFB0FD529C1365600FEC1A9 /* MultilineCommandBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultilineCommandBar.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -465,6 +464,7 @@
F3F113882A705AD500DA852A /* ListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListItem.swift; sourceTree = "<group>"; };
F3F1138C2A705B6900DA852A /* ListItemModifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListItemModifiers.swift; sourceTree = "<group>"; };
F5784DB9285D031800DBEAD6 /* docs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = docs; sourceTree = "<group>"; };
F5854ECF2C220AC100938291 /* TableViewCellTokenSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewCellTokenSet.swift; sourceTree = "<group>"; };
FC414E1E258876FB00069E73 /* CommandBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandBar.swift; sourceTree = "<group>"; };
FC414E242588798000069E73 /* CommandBarButtonGroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandBarButtonGroupView.swift; sourceTree = "<group>"; };
FC414E2A25887A4B00069E73 /* CommandBarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandBarButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -996,6 +996,7 @@
C0A0D75D233AEA9900F432FD /* Shimmer */,
1168630122E131A20088B302 /* Tab Bar */,
B444D6B421825B510002B4D4 /* Table View */,
F5854ED02C220AC100938291 /* TableViewListShared */,
EC98E2AB2980C0C000B9DF91 /* TextField */,
FD7DF05A21FA7F3200857267 /* Tooltip */,
5314DFF325F006060099271A /* TouchForwardingView */,
Expand Down Expand Up @@ -1088,7 +1089,6 @@
isa = PBXGroup;
children = (
B498141321E424920077B48D /* TableViewCell.swift */,
2A9745DD281733D700E1A1FD /* TableViewCellTokenSet.swift */,
B4EF66502294A664007FEAB0 /* TableViewHeaderFooterView.swift */,
0AE3041C29F721B2003CDDD9 /* TableViewHeaderFooterViewTokenSet.swift */,
);
Expand Down Expand Up @@ -1209,6 +1209,14 @@
path = List;
sourceTree = "<group>";
};
F5854ED02C220AC100938291 /* TableViewListShared */ = {
isa = PBXGroup;
children = (
F5854ECF2C220AC100938291 /* TableViewCellTokenSet.swift */,
);
path = TableViewListShared;
sourceTree = "<group>";
};
FC414E1D258876D400069E73 /* Command Bar */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1571,6 +1579,7 @@
3A9FC0F52A6AFAD40060A6BE /* BadgeFieldTokenSet.swift in Sources */,
5314E30325F0260E0099271A /* AccessibleViewDelegate.swift in Sources */,
6EB4B25F270ED6B30005B808 /* BadgeLabel.swift in Sources */,
F5854ED12C220AC100938291 /* TableViewCellTokenSet.swift in Sources */,
EC98E2B2298D97EC00B9DF91 /* TextFieldTokenSet.swift in Sources */,
9231491528BF026A001B033E /* HUD.swift in Sources */,
5314E1A725F01A7C0099271A /* ActionsCell.swift in Sources */,
Expand Down Expand Up @@ -1660,7 +1669,6 @@
EC5982D827BF348700FD048D /* MSFAvatar.swift in Sources */,
5314E0AA25F010070099271A /* DrawerShadowView.swift in Sources */,
4BDBE18928EC9E6F00314696 /* ShimmerTokenSet.swift in Sources */,
2A9745DE281733D700E1A1FD /* TableViewCellTokenSet.swift in Sources */,
530D9C5127EE388200BDCBBF /* SwiftUI+ViewPresentation.swift in Sources */,
92ECB2DD2BE069D100404D79 /* Color+DynamicColor.swift in Sources */,
6F050B6D29D3D1A90070D3D5 /* TabBarTokenSet.swift in Sources */,
Expand Down
5 changes: 0 additions & 5 deletions ios/FluentUI/Table View/TableView.resources.xcfilelist
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
checkmark-24x24.imageset
chevron-right-20x20.imageset
iOS-chevron-right-20x20.imageset
more-24x24.imageset
selection-off.imageset
selection-on.imageset
79 changes: 0 additions & 79 deletions ios/FluentUI/Table View/TableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,6 @@

import UIKit

// MARK: TableViewCellAccessoryType

@objc(MSFTableViewCellAccessoryType)
public enum TableViewCellAccessoryType: Int {
case none
case disclosureIndicator
case detailButton
case checkmark

private struct Constants {
static let horizontalSpacing: CGFloat = 16
static let height: CGFloat = 44
}

var icon: UIImage? {
let icon: UIImage?
switch self {
case .none:
icon = nil
case .disclosureIndicator:
icon = UIImage.staticImageNamed("iOS-chevron-right-20x20")
case .detailButton:
icon = UIImage.staticImageNamed("more-24x24")
case .checkmark:
icon = UIImage.staticImageNamed("checkmark-24x24")
}
return icon
}

func iconColor(tokenSet: TableViewCellTokenSet, fluentTheme: FluentTheme) -> UIColor? {
switch self {
case .none:
return nil
case .disclosureIndicator:
return tokenSet[.accessoryDisclosureIndicatorColor].uiColor
case .detailButton:
return tokenSet[.accessoryDetailButtonColor].uiColor
case .checkmark:
return tokenSet[.accessoryCheckmarkColor].uiColor
}
}

var size: CGSize {
if self == .none {
return .zero
}
// Horizontal spacing includes 16pt spacing from content to icon and 16pt spacing from icon to trailing edge of cell
let horizontalSpacing: CGFloat = Constants.horizontalSpacing * 2
let iconWidth: CGFloat = icon?.size.width ?? 0
return CGSize(width: horizontalSpacing + iconWidth, height: Constants.height)
}
}

// Different background color is used for `TableViewCell` by getting the appropriate tokens and integrate with the cell's `UIBackgroundConfiguration`
@objc(MSFTableViewCellBackgroundStyleType)
public enum TableViewCellBackgroundStyleType: Int {
// use for flat list of cells
case plain
// use for grouped list of cells
case grouped
// clear background so that TableView's background can be shown
case clear
// in case clients want to override the background on their own without using token system
case custom

func defaultColor(tokenSet: TableViewCellTokenSet) -> UIColor? {
switch self {
case .plain:
return tokenSet[.cellBackgroundColor].uiColor
case .grouped:
return tokenSet[.cellBackgroundGroupedColor].uiColor
case .clear:
return .clear
case .custom:
return nil
}
}
}

// Supported vertical alignment for accessory views in `TableViewCell`
@objc(MSFTableViewCellAccessoryViewVerticalAlignment)
public enum TableViewCellAccessoryViewVerticalAlignment: Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,82 @@ extension TableViewCellTokenSet {
case small
case medium
}

// MARK: TableViewCellAccessoryType

@objc(MSFTableViewCellAccessoryType)
public enum TableViewCellAccessoryType: Int {
case none
case disclosureIndicator
case detailButton
case checkmark

private struct Constants {
static let horizontalSpacing: CGFloat = 16
static let height: CGFloat = 44
}

var icon: UIImage? {
let icon: UIImage?
switch self {
case .none:
icon = nil
case .disclosureIndicator:
icon = UIImage.staticImageNamed("iOS-chevron-right-20x20")
case .detailButton:
icon = UIImage.staticImageNamed("more-24x24")
case .checkmark:
icon = UIImage.staticImageNamed("checkmark-24x24")
}
return icon
}

func iconColor(tokenSet: TableViewCellTokenSet, fluentTheme: FluentTheme) -> UIColor? {
switch self {
case .none:
return nil
case .disclosureIndicator:
return tokenSet[.accessoryDisclosureIndicatorColor].uiColor
case .detailButton:
return tokenSet[.accessoryDetailButtonColor].uiColor
case .checkmark:
return tokenSet[.accessoryCheckmarkColor].uiColor
}
}

var size: CGSize {
if self == .none {
return .zero
}
// Horizontal spacing includes 16pt spacing from content to icon and 16pt spacing from icon to trailing edge of cell
let horizontalSpacing: CGFloat = Constants.horizontalSpacing * 2
let iconWidth: CGFloat = icon?.size.width ?? 0
return CGSize(width: horizontalSpacing + iconWidth, height: Constants.height)
}
}

// Different background color is used for `TableViewCell` by getting the appropriate tokens and integrate with the cell's `UIBackgroundConfiguration`
@objc(MSFTableViewCellBackgroundStyleType)
public enum TableViewCellBackgroundStyleType: Int {
// use for flat list of cells
case plain
// use for grouped list of cells
case grouped
// clear background so that TableView's background can be shown
case clear
// in case clients want to override the background on their own without using token system
case custom

func defaultColor(tokenSet: TableViewCellTokenSet) -> UIColor? {
switch self {
case .plain:
return tokenSet[.cellBackgroundColor].uiColor
case .grouped:
return tokenSet[.cellBackgroundGroupedColor].uiColor
case .clear:
return .clear
case .custom:
return nil
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
checkmark-24x24.imageset
iOS-chevron-right-20x20.imageset
more-24x24.imageset
selection-off.imageset
selection-on.imageset

0 comments on commit 2d1071a

Please sign in to comment.