zekunyan / TTGTagCollectionView

Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time. It is highly customizable that most features of the text tag can be configured. 标签流显示控件,同时支持文字或自定义View
http://tutuge.me
MIT License
1.89k stars 260 forks source link

Compile Error: Duplicate interface definition for class 'TTGTextTagCollectionView' #109

Closed darkengine closed 3 years ago

darkengine commented 3 years ago

Compile with XCode 12.5, get error message:

/Pods/TTGTagCollectionView/Sources/TextTag/TTGTextTagCollectionView.h:46:1: Duplicate interface definition for class 'TTGTextTagCollectionView'

The duplicate interface definition is happened in "TTGTextTagCollectionView.h:46", so have no idea how to modify this.

zekunyan commented 3 years ago

@darkengine Which version ?

darkengine commented 3 years ago

@darkengine Which version ?

Version TTGTagCollectionView (2.0.1)

zekunyan commented 3 years ago

@darkengine I try myself on my Mac mini M1 on a pure new project and it works fine. (2.0.1 version) Maybe you should clean your cocoapods cache and run pod update completely from the begin.

KinmoCode commented 3 years ago

@darkengine Is this problem solved?

darkengine commented 3 years ago

@darkengine Is this problem solved?

Hi @zekunyan and @kinmoLun ,

Thanks for the advice. I start a new Objective-C project (With XCode 12.5) and add "TTGTagCollectionView" using cocoapods. Unfortunately, it shows the same error message. The codes in my ViewControll.m is:

//
//  ViewController.m
//  StoneTestTags
//
//  Created by Stone on 2021/6/11.
//

#import "ViewController.h"
#import <TTGTextTagCollectionView.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // test text tags
    // Create TTGTextTagCollectionView view
    TTGTextTagCollectionView *tagCollectionView = [[TTGTextTagCollectionView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
    [self.view addSubview:tagCollectionView];
    // Create TTGTextTag object
    TTGTextTag *textTag = [TTGTextTag tagWithContent:[TTGTextTagStringContent contentWithText:@"Some text"] style:[TTGTextTagStyle new]];
    // Add tag
    [tagCollectionView addTag:textTag];
}

@end
darkengine commented 3 years ago

Update! I get it works by changing the import file to:

#import <TTGTagCollectionView/TTGTextTagCollectionView.h>

The old import statement works in the previous version.

zekunyan commented 3 years ago

@darkengine Great work ! Maybe the new version of Cocoapods you used needs strict import rules.