当在iOS中本地或远程安装Pod时,无法看到额外添加的.swift文件

问题描述:

我使用pod lib create 'mypodname'创建了一个Pod。以下是由Xcode给出的默认结构 。当在iOS中本地或远程安装Pod时,无法看到额外添加的.swift文件

enter image description here

  • 大部分的教程,我可以看到文件夹叫ClassesMyFirtTestPod文件夹内。但在这里我们没有它。
  • 在另一方面,我可以添加新的.swift文件,但使用本地路径到另一个项目,或者truncated后远程安装后只能看到ReplaceMe.swift.swift文件安装在吊舱后。 我试着删除RepalceMe.swift文件并添加新的.swift文件。但没有工作。我唯一能做的就是重命名ReplaceMe.swift。我可以看到这些文件github但不是在装舱

这个我.podspec文件,并根据您的文章标题的文件结构

enter image description here

+0

在这里发表您podspec – Bannings

+0

@Bannings这里添加的podspec – Jobs

+0

@JonasSchafft你是什么意思。在这里我创建一个pod,不使用pod – Jobs

,你看不到已安装的容器中有新的.swift文件,对吗?

在新创建的文件.podspec,你可以看到Cocoapod的有关源代码注释:

# ――― 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. 
    # 

几乎所有(除Bolts)在Cocoapod框架我用没有文件夹。所以当你浏览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' }