我使用 pod lib create 'mypodname'
创建了一个 pod。下面是
Xcode 给出的默认结构。
- 大多数教程,我可以在
MyFirtTestPod
文件夹中看到名为Classes
的文件夹。但我们这里没有。 - 另一方面,我可以添加新的
.swift
文件,但是在使用本地路径安装 pod 到另一个项目之后,或者在truncated
远程安装之后只能看到ReplaceMe.swift
为.swift
文件。 我尝试删除RepalceMe.swift
文件并添加新的.swift
文件。但没有用。我唯一能做的就是重命名ReplaceMe.swift
。我可以在github
中看到这些文件,但在安装的 pod 中看不到
这是我的.podspec
文件和文件结构
最佳答案
根据您的帖子标题,您在已安装的 pod 中看不到新的 .swift
文件,对吗?
在你新建的.podspec
文件中,你可以看到Cocoapod对Source Code的注释:
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#
我使用的 Cocoapod 中几乎所有(Bolts
除外)框架都没有文件夹。因此,当您浏览 Pods > AFramework 时,您已经可以看到它的类。
这里是源码和资源最简单的.podspec
代码。尝试一下。如您所见,我从我的 pod 的根文件夹中为源代码部分提供了我的路径。 GPKit/**/*.{swift}
以及我的资源。过去我遇到过与您相同的问题,但资源(例如 .xib
)而不是 .swift
文件。
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#
s.source_files = "GPKit", "GPKit/**/*.{swift}"
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
#
# s.resource = "icon.png"
# s.resources = "Resources/*.png"
s.resources = "GPKit/**/*.{xib}"
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3' }
关于ios - 在 iOS 中本地或远程安装 pod 时看不到额外添加的 .swift 文件,swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46193145/