-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from APPSCHOOL3-iOS/TabBarView
TabBarView(#1)
- Loading branch information
Showing
3 changed files
with
30 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
project02-teamB-OUR-consumer/project02-teamB-OUR-consumer/Extension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Extension.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by 윤해수 on 2023/08/22. | ||
// | ||
|
||
import SwiftUI | ||
|
||
//Color extension확장하여 Hex Color 받아서 바꾸기 | ||
extension Color { | ||
init(hex: String) { | ||
var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines) | ||
hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "") | ||
|
||
var rgb: UInt64 = 0 | ||
|
||
Scanner(string: hexSanitized).scanHexInt64(&rgb) | ||
|
||
self.init( | ||
red: Double((rgb & 0xFF0000) >> 16) / 255.0, | ||
green: Double((rgb & 0x00FF00) >> 8) / 255.0, | ||
blue: Double(rgb & 0x0000FF) / 255.0 | ||
) | ||
} | ||
} |