运营商仅允许在全球范围内运营

时间:2015-08-14 08:16:42

标签: swift2

我正在编写一个应用程序,它将时间符号与一段时间进行比较,然后获取扇区数,然后返回一个任务限制。

例如,0035两个扇区的登录符合1030的职责限制。

这在我的Playground中运行正常,但在转移到Xcode时会出现几个编译器错误。

从&#34开始;只允许在全球范围内运营商"。

有人能指出我正确的方向吗?

到目前为止,这是我的代码:

let dateMaker = NSDateFormatter()
dateMaker.dateFormat = "HHmm"

let FTL1 = dateMaker.dateFromString("0800")!
let FTL2 = dateMaker.dateFromString("1259")!
let FTL3 = dateMaker.dateFromString("1300")!
let FTL4 = dateMaker.dateFromString("1759")!
let FTL5 = dateMaker.dateFromString("1800")!
let FTL6 = dateMaker.dateFromString("2159")!
let FTL7 = dateMaker.dateFromString("2200")!
let FTL8 = dateMaker.dateFromString("2359")!
let FTL9 = dateMaker.dateFromString("0000")!
let FTL10 = dateMaker.dateFromString("0759")!

let SO = dateMaker.dateFromString("0035")
var sect = 2

func <(lhs: NSDate, rhs: NSDate) -> Bool
{
    return lhs.compare(rhs) == .OrderedAscending
}

func >(lhs: NSDate, rhs: NSDate) -> Bool
{
    return lhs.compare(rhs) == .OrderedDescending
}


if SO! == FTL1 || SO! == FTL2 || SO! > FTL1 && SO! < FTL2 {

    if sect == 1 {
    let FTL = "1400"
    }
    if sect == 2 {
      let FTL = "1315"
    }
    if sect == 3 {
        let FTL = "1230"
    }
}
if SO! == FTL3 || SO! == FTL4 || SO! > FTL3 && SO! < FTL4 {

    if sect == 1 {
        let FTL = "1300"
    }
    if sect == 2 {
        let FTL = "1215"
    }
    if sect == 3 {
        let FTL = "1130"
    }
}
if SO! == FTL5 || SO! == FTL6 || SO! > FTL5 && SO! < FTL6 {

    if sect == 1 {
        let FTL = "1200"
    }
    if sect == 2 {
        let FTL = "1115"
    }
    if sect == 3 {
        let FTL = "1030"
    }
}

if SO! == FTL7 || SO! == FTL8 || SO! > FTL7 && SO! < FTL8 {

    if sect == 1 {
        let FTL = "1100"
    }
    if sect == 2 {
        let FTL = "1030"
    }
    if sect == 3 {
        let FTL = "0930"
    }
}

if SO! == FTL9 || SO! == FTL10 || SO! > FTL9 && SO! < FTL10 {

    if sect == 1 {
        let FTL = "1100"
    }
    if sect == 2 {
        let FTL = "1030"
    }
    if sect == 3 {
        let FTL = "0930"
    }
}

1 个答案:

答案 0 :(得分:1)

你应该在课堂上编写代码

class NewObject {
}
func >(lhs: NSDate, rhs: NSDate) -> Bool
{
     return lhs.compare(rhs) == .OrderedDescending
}