混编Objective-C 和 Swift
发布日期:2021-08-28 04:40:43 浏览次数:2 分类:技术文章

本文共 823 字,大约阅读时间需要 2 分钟。

hot3.png

本次已经有了一个Objective-C项目

1.创建 Demo-Bridging-Header.h,此页面声明的文件的所有的文件都可以用

Use this file to import your target's public headers that you would like to expose to Swift.

新工程刚创建时创建swift file可以自动生成;

若不自动生成可以手动创建

2.设置build Setting->package

120334_j7cF_2476972.png

3.在需要用的文件导入XXX-Swift.h,XXX是Product Module Name de值

此处为Demo-Swift.h

然后可以使用Swift的类和方法了

    DGElasticPullToRefreshLoadingViewCircle * cricle = [[DGElasticPullToRefreshLoadingViewCircle alloc] init];

    cricle.tintColor = [UIColor colorWithRed:78/255.0 green:221/255.0 blue:200/255.0 alpha:1.0];
    [self.tableView dg_addPullToRefreshWithActionHandler:^{
        [self.tableView dg_stopLoading];
    } loadingView:cricle];
    [self.tableView dg_setPullToRefreshFillColor:[UIColor colorWithRed:57/255.0 green:67/255.0 blue:89/255.0 alpha:1]];

工程结果如下:

113732_sHYF_2476972.gif

反过来混编也是类似,不再赘述

附上刷新作者工程

转载于:https://my.oschina.net/bieshixuan/blog/607308

转载地址:https://blog.csdn.net/weixin_33940102/article/details/92443226 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:关于BigDecimal四舍五入模式
下一篇:审计插件

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月08日 06时06分29秒