feat: 🎨 Add app icon

This commit is contained in:
Louis Gallet 2023-11-04 15:26:49 +01:00
parent f896343074
commit 48d387185f
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY
18 changed files with 145 additions and 47 deletions

View File

@ -14,6 +14,7 @@
2CCE3EAD2AF67A9000BB0ED3 /* UtilsFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */; };
2CCE3EAF2AF67BA900BB0ED3 /* BinaryConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */; };
2CCE3EB12AF67CFD00BB0ED3 /* HexaConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */; };
2CCE3EB52AF6879200BB0ED3 /* OctalConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EB42AF6879200BB0ED3 /* OctalConverter.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -25,6 +26,7 @@
2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilsFunctions.swift; sourceTree = "<group>"; };
2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryConverter.swift; sourceTree = "<group>"; };
2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexaConverter.swift; sourceTree = "<group>"; };
2CCE3EB42AF6879200BB0ED3 /* OctalConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OctalConverter.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -59,6 +61,7 @@
children = (
2CCE3E9E2AF678B200BB0ED3 /* BinaryConverterApp.swift */,
2CCE3EA02AF678B200BB0ED3 /* ContentView.swift */,
2CCE3EB42AF6879200BB0ED3 /* OctalConverter.swift */,
2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */,
2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */,
2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */,
@ -150,6 +153,7 @@
2CCE3EAF2AF67BA900BB0ED3 /* BinaryConverter.swift in Sources */,
2CCE3EAD2AF67A9000BB0ED3 /* UtilsFunctions.swift in Sources */,
2CCE3EB12AF67CFD00BB0ED3 /* HexaConverter.swift in Sources */,
2CCE3EB52AF6879200BB0ED3 /* OctalConverter.swift in Sources */,
2CCE3E9F2AF678B200BB0ED3 /* BinaryConverterApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -287,11 +291,13 @@
DEVELOPMENT_TEAM = KK24298HY5;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "Binary Converter";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -299,9 +305,12 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = fr.louisgallet.BinaryConverter;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
@ -316,11 +325,13 @@
DEVELOPMENT_TEAM = KK24298HY5;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "Binary Converter";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -328,9 +339,12 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = fr.louisgallet.BinaryConverter;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,8 +1,75 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"filename" : "40.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "60.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "29.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "58.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "87.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "80.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "120.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "57.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "57x57"
},
{
"filename" : "114.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "57x57"
},
{
"filename" : "120.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "180.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],

View File

@ -20,25 +20,8 @@ struct BinaryConverter: View {
Text("Your number in base 2: \(binaryNumber)")
}
}
// .onChange(of: decimalNumber) {
// [decimalNumber] newValue in
// if newValue != decimalNumber {
// binaryNumber = convertToBinary(newValue)
// }
// }
.onChange(of: decimalNumber, initial: true, {
oldDecimalNumber, NewDecimalNumber in
if (oldDecimalNumber != NewDecimalNumber) {
binaryNumber = convertToBinary(NewDecimalNumber)
}
})
}
func convertToBinary(_ decimalString: String) -> String {
if let decimal = Int(decimalString) {
// Perform your base conversion logic here
return String(decimal, radix: 2)
} else {
return "Invalid Input"
.onChange(of: decimalNumber) { newValue in
binaryNumber = convertToBinary(newValue)
}
}
}

View File

@ -12,8 +12,8 @@ struct ContentView: View {
var body: some View {
TabView(selection: $selectedTab,
content: {
BinaryConverter().tabItem { Image(systemName: "1.square.fill") ; Text("Binary") }.tag(0)
HexaConverter().tabItem { Image(systemName: "2.square.fill") ; Text("Hexa") }.tag(1)
BinaryConverter().tabItem { Image(systemName: "2.square.fill") ; Text("Binary") }.tag(0)
HexaConverter().tabItem { Image(systemName: "16.square.fill") ; Text("Hexa") }.tag(1)
})
}

View File

@ -8,8 +8,21 @@
import SwiftUI
struct HexaConverter: View {
@State private var decimalNumber: String = ""
@State private var HexadecimalNumber: String = ""
var body: some View {
Text("Hello, Hexa!")
Form {
Section(header: Text("Base 10")) {
TextField("Enter the base 10 number here", text: $decimalNumber)
.keyboardType(.numberPad)
}
Section(header: Text("Base 2")) {
Text("Your number in base 16: \(HexadecimalNumber)")
}
}
.onChange(of: decimalNumber) { newValue in
HexadecimalNumber = convertToBinary(newValue)
}
}
}

View File

@ -0,0 +1,18 @@
//
// OctalConverter.swift
// BinaryConverter
//
// Created by Louis Gallet on 04/11/2023.
//
import SwiftUI
struct OctalConverter: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
OctalConverter()
}

View File

@ -7,22 +7,25 @@
import Foundation
extension BinaryInteger {
var binaryDescription: String {
/// Convert a given number to it's binary representation
/// source: https://stackoverflow.com/questions/26181221/how-to-convert-a-decimal-number-to-binary-in-swift
var binaryString = ""
var internalNumber = self
var counter = 0
for _ in (1...self.bitWidth) {
binaryString.insert(contentsOf: "\(internalNumber & 1)", at: binaryString.startIndex)
internalNumber >>= 1
counter += 1
if counter % 4 == 0 {
binaryString.insert(contentsOf: " ", at: binaryString.startIndex)
}
}
return binaryString
/// Convert a given number to its binary form
/// - Parameter decimalString: Your number in base10 in String format
/// - Returns: Return the number in base2 in String format or return "Invalid Input" if the input is not valid
func convertToBinary(_ decimalString: String) -> String {
if let decimal = Int(decimalString) {
return String(decimal, radix: 2)
} else {
return "Invalid Input"
}
}
/// Convert a given number to its hexadeciam form
/// - Parameter decimalString: Your number in base10 in String format
/// - Returns: Return the number in base16 in String format or return "Invalid Input" if the input is not valid
func convertToHex(_ decimalString: String) -> String {
if let number = Int(decimalString) {
let hexString = String(number, radix: 16)
return hexString.uppercased()
} else {
return "Invalid Input"
}
}