Skip to content

Commit

Permalink
Add clean Float modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
bstillitano committed Apr 7, 2024
1 parent 7ff7c1e commit c9da1f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Sources/Scyther/Extensions/Float+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// File.swift
//
//
// Created by Brandon Stillitano on 7/4/2024.
//

import Foundation

extension Float {
/// Returns a ``String`` representation of this value, with no decimals.
var clean: String {
return self.truncatingRemainder(dividingBy: 1) == 0 ? String(format: "%.0f", self) : String(self)
}
}
4 changes: 2 additions & 2 deletions Sources/Scyther/User Interface/Menu/MenuViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ internal class MenuViewModel {
value: UIDevice.current.modelName,
icon: nil))
deviceSection.rows.append(valueRow(name: "Release Year",
value: String(UIDevice.current.generation),
value: UIDevice.current.generation.clean,
icon: nil,
showMenu: true))
deviceSection.rows.append(valueRow(name: "UDID",
Expand All @@ -132,7 +132,7 @@ internal class MenuViewModel {
icon: nil))
if let value = Bundle.main.seedId {
applicationSection.rows.append(valueRow(name: "App ID Prefix",
value: Bundle.main.bundleIdentifier,
value: value,
icon: nil))
}
applicationSection.rows.append(valueRow(name: "Version",
Expand Down

0 comments on commit c9da1f4

Please sign in to comment.