首页 > 解决方案 > typedef 的 swift 等价物

问题描述

在 C 语言中,我会写如下内容:

    typedef struct old new;
struct old
{
    int x = 0;
    int y = 0;
};

我无法在 swift 中找到等价物。

请帮我

标签: iosswift

解决方案


很快它看起来像这样:

typealias new = old

struct old {
    let x = 0
    let y = 0
}

推荐阅读