pEpForiOS/UI/Folder/ViewModel/FolderCellViewModel.swift
author Dirk Zimmermann <dirk@pep-project.org>
Tue, 23 May 2017 11:32:32 +0200
changeset 2191 a01eb69e9664
parent 2045 01b83254d3de
child 2664 874827a49c0f
permissions -rw-r--r--
IOS-490 viewed folders marked as "interesting"
xavier@1750
     1
//
xavier@1750
     2
//  FolderViewModel.swift
xavier@1750
     3
//  pEpForiOS
xavier@1750
     4
//
xavier@1750
     5
//  Created by Xavier Algarra on 20/02/17.
xavier@1750
     6
//  Copyright © 2017 p≡p Security S.A. All rights reserved.
xavier@1750
     7
//
xavier@1750
     8
xavier@1750
     9
import Foundation
xavier@1750
    10
import MessageModel
xavier@1750
    11
xavier@1750
    12
public class FolderCellViewModel {
xavier@1757
    13
    public var icon: UIImage {
xavier@1757
    14
        return self.folder.folderType.getIconType()
xavier@1757
    15
    }
dirk@2191
    16
xavier@1757
    17
    public var title : String {
xavier@1757
    18
        return self.name
xavier@1757
    19
    }
dirk@2191
    20
xavier@1757
    21
    public var number: Int {
xavier@1757
    22
        return 0 //fake number
xavier@1757
    23
    }
dirk@2191
    24
xavier@1757
    25
    public var arrow: UIImage {
xavier@1757
    26
        return UIImage(named: "arrow_down_icon")!
xavier@1757
    27
    }
xavier@1757
    28
xavier@2040
    29
    var folder: Folder
xavier@1772
    30
    var level : Int
xavier@1750
    31
xavier@1750
    32
    public init(folder: Folder, level: Int) {
xavier@1750
    33
        self.folder = folder
xavier@1750
    34
        self.level = level
xavier@1750
    35
    }
xavier@1750
    36
xavier@2040
    37
    func getFolder() -> Folder {
xavier@2040
    38
        return folder
xavier@2040
    39
    }
xavier@2040
    40
xavier@1757
    41
    private var name:String {
xavier@1772
    42
        return self.folder.realName
xavier@1750
    43
    }
xavier@1750
    44
xavier@1750
    45
    var leftPadding: Int {
xavier@1750
    46
        return level
xavier@1750
    47
    }
xavier@1750
    48
}