Enhancement of the clamping the index for the seed

This commit is contained in:
Lukas Korba 2022-02-17 14:42:16 +01:00
parent 212d130bfb
commit c564215328
3 changed files with 18 additions and 1 deletions

View File

@ -71,6 +71,7 @@
66A0807B271993C500118B79 /* OnboardingProgressIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66A0807A271993C500118B79 /* OnboardingProgressIndicator.swift */; };
66D50668271D9B6100E51F0D /* NavigationButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66D50667271D9B6100E51F0D /* NavigationButtonStyle.swift */; };
66DC733F271D88CC0053CBB6 /* StandardButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66DC733E271D88CC0053CBB6 /* StandardButtonStyle.swift */; };
9E06EFF027BE87BA001E3A08 /* SeedIndex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E06EFEF27BE87BA001E3A08 /* SeedIndex.swift */; };
F9322DC0273B555C00C105B5 /* NavigationLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9322DBF273B555C00C105B5 /* NavigationLinks.swift */; };
F93673D62742CB840099C6AF /* Previews.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93673D52742CB840099C6AF /* Previews.swift */; };
F93874F0273C4DE200F0E875 /* HomeStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93874ED273C4DE200F0E875 /* HomeStore.swift */; };
@ -188,6 +189,7 @@
66A0807A271993C500118B79 /* OnboardingProgressIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingProgressIndicator.swift; sourceTree = "<group>"; };
66D50667271D9B6100E51F0D /* NavigationButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationButtonStyle.swift; sourceTree = "<group>"; };
66DC733E271D88CC0053CBB6 /* StandardButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StandardButtonStyle.swift; sourceTree = "<group>"; };
9E06EFEF27BE87BA001E3A08 /* SeedIndex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeedIndex.swift; sourceTree = "<group>"; };
F9322DBF273B555C00C105B5 /* NavigationLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationLinks.swift; sourceTree = "<group>"; };
F93673D52742CB840099C6AF /* Previews.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Previews.swift; sourceTree = "<group>"; };
F93874ED273C4DE200F0E875 /* HomeStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeStore.swift; sourceTree = "<group>"; };
@ -439,6 +441,7 @@
F9C165B3274031F600592F76 /* Bindings.swift */,
F9EEB8152742C2210032EEB8 /* WithStateBinding.swift */,
F93673D52742CB840099C6AF /* Previews.swift */,
9E06EFEF27BE87BA001E3A08 /* SeedIndex.swift */,
);
path = Util;
sourceTree = "<group>";
@ -978,6 +981,7 @@
0D3D040A2728B3A10032ABC1 /* RecoveryPhraseDisplayStore.swift in Sources */,
0D4E7A0B26B364170058B01E /* ContentView.swift in Sources */,
0D354A0926D5A9D000315F45 /* Services.swift in Sources */,
9E06EFF027BE87BA001E3A08 /* SeedIndex.swift in Sources */,
660558F7270C862F009D6954 /* Fonts+Generated.swift in Sources */,
F96B41E7273B501F0021B49A /* TransactionHistoryStore.swift in Sources */,
F9971A5A27680DDE00A2DB75 /* RequestView.swift in Sources */,

View File

@ -8,7 +8,7 @@
import SwiftUI
struct EnumeratedChip: View {
@Clamped(1...24)
@SeedIndex
var index: Int = 1
var text: String

View File

@ -0,0 +1,13 @@
//
// SeedIndex.swift
// secant-testnet
//
// Created by Lukáš Korba on 17.02.2022.
//
@propertyWrapper
struct SeedIndex {
var wrappedValue: Int {
didSet { wrappedValue = min(24, max(1, wrappedValue)) }
}
}