Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift变量与内存使用_Ios_Swift_Memory Management - Fatal编程技术网

Ios Swift变量与内存使用

Ios Swift变量与内存使用,ios,swift,memory-management,Ios,Swift,Memory Management,我使用故事板segue在整个应用程序中导航。我为segue identifier和table cell identifier声明字符串变量。因此,我不会在视图控制器类中进行任何输入错误 import UIKit private let showTripViewSegueIdentifier = "showTripView" private let contactCellIdentifier = "contactCell" class JobViewController: UIViewCont

我使用故事板segue在整个应用程序中导航。我为
segue identifier
table cell identifier
声明字符串变量。因此,我不会在视图控制器类中进行任何输入错误

import UIKit

private let showTripViewSegueIdentifier = "showTripView"
private let contactCellIdentifier = "contactCell"

class JobViewController: UIViewController , UITableViewDataSource,UITableViewDelegate{
}
它会影响应用程序的内存使用吗?(因为整个应用程序将有很多视图控制器)。这是一个好方法吗


提前谢谢。

这不会有太大的区别。无论如何,字符串都必须存储在某个地方,因为您在运行时使用它们。

这不会产生显著的差异。无论如何,字符串都必须存储在某个位置,因为您在运行时使用它们。

声明如下枚举:

枚举序列标识符:字符串{ 案例序列识别器1 案例序列识别器2 案例序列识别器3
}

像这样声明一个枚举:

枚举序列标识符:字符串{ 案例序列识别器1 案例序列识别器2 案例序列识别器3
}

这不应该真的有什么区别。然而,更好的方法是使用上面Arun提到的enum

例如


并借助较短的点语法在代码中使用它。例如-
.contactCell

它不应该真的有什么区别。然而,更好的方法是使用上面Arun提到的enum

例如


并借助较短的点语法在代码中使用它。例如-
.contactCell

请详细说明您的问题和支持细节。措辞非常不清楚:(我已经读了你的问题三遍,但仍然没有看到你提出的实际问题:(请扩大你的问题和支持细节。措辞非常不清楚:(我已经读了你的问题三遍,仍然没有看到你问的实际问题:(
enum SegueIdentifier{
    case showTripView
    case contactCell
}