2017-09-13 103 views
1

我使用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

回答

0

,你看不到已安裝的容器中有新的.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' } 
相關問題