我在项目中使用了Material Design Component Library,并通过CocoaPods导入了它。
pod 'MaterialComponents'
在“材料设计组件文档”的“常见问题”部分中,有关不导入所有组件(仅导入所需组件)的部分。但我找不到该怎么做。
有人知道该怎么做吗?
预先感谢
答案 0 :(得分:0)
根据MaterialComponents.podspec,有很多子规格。
示例:
mdc.subspec "BottomAppBar" do |component|
component.ios.deployment_target = '8.0'
component.public_header_files = "components/#{component.base_name}/src/*.h"
component.source_files = "components/#{component.base_name}/src/*.{h,m}", "components/#{component.base_name}/src/private/*.{h,m}"
component.dependency "MDFInternationalization"
component.dependency "MaterialComponents/Buttons"
component.dependency "MaterialComponents/NavigationBar"
component.dependency "MaterialComponents/private/Math"
component.test_spec 'tests' do |tests|
tests.test_spec 'unit' do |unit_tests|
unit_tests.source_files = "components/#{component.base_name}/tests/unit/*.{h,m,swift}", "components/#{component.base_name}/tests/unit/supplemental/*.{h,m,swift}"
unit_tests.resources = "components/#{component.base_name}/tests/unit/resources/*"
end
end
end
如果只需要BottomAppBar
,而不是:
pod 'MaterialComponents'
做
pod 'MaterialComponents/BottomAppBar'
由于有component.dependency
个,因此您也会拥有它们(正常,BottomAppBar
应该需要它们工作)。