jhennyferOliveira / DiarioDeAprendizado

5 stars 0 forks source link

[DA-03] Submenu Diário #8

Closed jhennyferOliveira closed 4 years ago

jhennyferOliveira commented 4 years ago
viniciusmesquitac commented 4 years ago

eu coloquei um função dentro do menu do diario. showAnotation(), nela eu coloquei um espaço pra chamar algo para o submenu selecionar a anotação

viniciusmesquitac commented 4 years ago

pro usuário ver a anotação, selecionar e ver o texto de fato.

viniciusmesquitac commented 4 years ago
    func showAnotations() {
        let service = Service<Anotation>()
        let diary = service.read(filePath: completePathDiary)

        let anotations = diario.enumerated().map { (index, anotation) in
            return "\(index) - \(anotation.titulo)" // array: String = ["0 - teste". "1 - teste" ," 2 - teste"]
        }.reduce(""){ $0 + "\n" + $1 } // junta elementos do array -> 0 - teste \n 1 - teste

        print("""
            Anotações:
            \(anotations)

            Obs: para visualizar a anotação, basta escrever o indice ou nome da anotação.
            """)
        /* not implemented yet [submenu select anotation]

         let screen_select_anotation = ScreenSelectAnotation()
         screen_select_anotation.main()
        */
    }