简体   繁体   English

如何在XCode编辑器中查看生成的管理对象类别/扩展名

[英]How to view generated managed object category/extension in XCode Editor

In Core data when I create a data model, I choose to generate the category extension, I understand that this is created in derived data 在创建数据模型时,在Core数据中,我选择生成类别扩展,我知道这是在派生数据中创建的

在此处输入图片说明 I want to be able to view this in the XCode code editor but I don't know how I can open it just to view it. 我希望能够在XCode代码编辑器中查看此内容,但我不知道如何仅通过查看即可打开它。

I am using XCode 9 beta 3 我正在使用XCode 9 beta 3

The ways I can manage to do this is by typing some thing such as 我可以设法完成此操作的方法是键入一些内容,例如

let m  = MenuItem()
let n = m.name

In the code editor and then command clicking on name and then it jumps to the file, or finding the generated extension in Finder and opening from there. 在代码编辑器中,然后命令单击名称 ,然后跳转到文件,或在Finder中找到生成的扩展名并从中打开。

//
//  MenuItem+CoreDataProperties.swift
//  
//
//  Created by Ryan.Heitner on 01/08/2017.
//
//  This file was automatically generated and should not be edited.
//

import Foundation
import CoreData


extension MenuItem {

    @nonobjc public class func fetchRequest() -> NSFetchRequest<MenuItem> {
        return NSFetchRequest<MenuItem>(entityName: "MenuItem")
    }

    @NSManaged public var available: Bool
    @NSManaged public var desc: String?
    @NSManaged public var name: String?
    @NSManaged public var price: Double

}

The category extension seems buggy to me. 在我看来,类别扩展名似乎有问题。 Just select "Manual/None", then select an entity or all entities and click on Editor->Create NSManagedObject Subclass, choose your entities and the extensions should be shown under your project root in Xcode. 只需选择“手动/无”,然后选择一个实体或所有实体,然后单击“编辑器”->“创建NSManagedObject子类”,选择您的实体,扩展名应显示在Xcode的项目根目录下。

Unfortunately what you're doing is the only option Xcode provides. 不幸的是,您正在做的是Xcode提供的唯一选项。 It's not good, but you haven't missed anything. 不好,但是您什么都没错过。 I suggest filing a bug with Apple about this. 我建议就此向苹果提交错误。 In the meantime, either deal with this as it is, or switch to some other means of generating your properties-- manually maybe, or using mogenerator . 同时,要么按原样处理,要么切换到其他方式来生成您的属性-可以手动生成,或使用mogenerator

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM