swift - 在 Swift 源代码中发现不可打印的 ASCII 字符

标签 swift xcode

enter image description here

嗨,我是 Swift 语言的新手,谁能解释一下为什么这里的 PI 符号有错误。

import Foundation

class CalculatorBrain
{

    private var accumulator = 0.0

    func setOperand(operand : Double) {
        accumulator = operand
    }

    func performOperations (symbol: String) {
        switch symbol {
            case "π" :
                accumulator = M_PI
            case "√" :
                accumulator = sqrt(accumulator)
            default : break
        }
    }

    var result : Double {
        get{
            return accumulator
        }
    }
}

引用资料 https://youtu.be/j50mPzDMWVQ?t=2303

最佳答案

在 Xcode 中:“Editor”菜单,“Show Invisibles”。这将向您显示源代码中的不可见字符。

关于swift - 在 Swift 源代码中发现不可打印的 ASCII 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39329041/

相关文章:

ios - 使用 SwiftUI 接收 APNS 后显示 View

ios - 如何声明新数组来附加元组数组?

json - 我该如何在这个 JSON 之后创建一个 Struct 模型?

xcode - 迪尔德 : Symbol not found: ___chkstk_darwin

iphone - 如何去除 iPhone 应用程序图标的光泽?

xcode - 如何动态设置应用程序的内部版本号而不弄脏源代码树?

ios - UITextFieldDelegate 扩展。获取用户将在 UITextField 中看到的内容。 swift 4

json - 使用 SwiftyJSON 将 JSON 输出转换为数组

ios - 如何在 Swift 4 中将 Encodable 或 Decodable 作为参数传递?

ios - CocoaPods "target has transitive dependencies that include static binaries"