Mercurial > public > lazybear
changeset 210:4cdd0b7f807c
Delete IconRow
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sat, 27 Feb 2021 12:44:23 +0000 |
parents | 4e3f510ad14d |
children | 43a05e129bad |
files | LazyBear/UI/IconRow.swift |
diffstat | 1 files changed, 0 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/LazyBear/UI/IconRow.swift Sat Feb 27 12:44:13 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -// -// IconRow.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 26/2/21. -// - -import SwiftUI - -struct IconRow: View { - var icon: IconModel - - var body: some View { - Button(action: { changeIcon(key: icon.file) }) { - HStack { - Image(icon.file) - .resizable() - .frame(width: 70, height: 70) - - Text(icon.name) - Spacer() - - if UIApplication.shared.alternateIconName ?? "defaultIcon" == icon.file { - Text("Selected") - } - } - } - } - - private func changeIcon(key: String) { - if key != "defaultIcon" { - UIApplication.shared.setAlternateIconName(key) { error in - if let error = error { - print(error.localizedDescription) - } else { - print("Success!") - } - } - } else { - UIApplication.shared.setAlternateIconName(nil) - } - } -} - -struct IconRow_Previews: PreviewProvider { - static var previews: some View { - IconRow(icon: icons[0]) - } -}