Skip to content

Commit

Permalink
Added UIColor Bride
Browse files Browse the repository at this point in the history
Added color bride to improve Dark Mode compatibility
  • Loading branch information
martin-headspace committed Feb 19, 2020
1 parent f697e28 commit dcbdf1c
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 1 deletion.
12 changes: 12 additions & 0 deletions FlinkChallenge/FlinkChallenge.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
BD810CEF23FDB95F00D7853A /* AdvancedFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD810CEE23FDB95F00D7853A /* AdvancedFilterView.swift */; };
BD810D3723FDD82B00D7853A /* CharacterFilteringController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD810D3623FDD82B00D7853A /* CharacterFilteringController.swift */; };
BD810D3923FDDC4200D7853A /* CharacterFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD810D3823FDDC4200D7853A /* CharacterFilterView.swift */; };
BD810D3C23FDFDFE00D7853A /* Color+UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD810D3B23FDFDFE00D7853A /* Color+UIColor.swift */; };
EB91B40C69510498EB2574BC /* Pods_FlinkChallengeTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DFA73F2EF25F32DFDB17F885 /* Pods_FlinkChallengeTests.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -67,6 +68,7 @@
BD810CEE23FDB95F00D7853A /* AdvancedFilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedFilterView.swift; sourceTree = "<group>"; };
BD810D3623FDD82B00D7853A /* CharacterFilteringController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterFilteringController.swift; sourceTree = "<group>"; };
BD810D3823FDDC4200D7853A /* CharacterFilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterFilterView.swift; sourceTree = "<group>"; };
BD810D3B23FDFDFE00D7853A /* Color+UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+UIColor.swift"; sourceTree = "<group>"; };
DFA73F2EF25F32DFDB17F885 /* Pods_FlinkChallengeTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FlinkChallengeTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -124,6 +126,7 @@
BD6A5E3F23FC7FF7003B1E4D /* FlinkChallenge */ = {
isa = PBXGroup;
children = (
BD810D3A23FDFDE000D7853A /* Extensions */,
BD6A5E6F23FCEB3A003B1E4D /* Controller */,
BD6A5E6723FC8EEC003B1E4D /* Views */,
BD6A5E6223FC81E2003B1E4D /* Model */,
Expand Down Expand Up @@ -187,6 +190,14 @@
path = Controller;
sourceTree = "<group>";
};
BD810D3A23FDFDE000D7853A /* Extensions */ = {
isa = PBXGroup;
children = (
BD810D3B23FDFDFE00D7853A /* Color+UIColor.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
DC42C48C82B2AC45F8F56004 /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -372,6 +383,7 @@
BD6A5E7323FCEBA0003B1E4D /* Episode.swift in Sources */,
BD6A5E7723FD003A003B1E4D /* SearchBarUIView.swift in Sources */,
BD6A5E7123FCEB6C003B1E4D /* EpisodeController.swift in Sources */,
BD810D3C23FDFDFE00D7853A /* Color+UIColor.swift in Sources */,
BD6A5E4123FC7FF7003B1E4D /* AppDelegate.swift in Sources */,
BD6A5E4323FC7FF7003B1E4D /* SceneDelegate.swift in Sources */,
BD6A5E6423FC823D003B1E4D /* APICharacter.swift in Sources */,
Expand Down
130 changes: 130 additions & 0 deletions FlinkChallenge/FlinkChallenge/Extensions/Color+UIColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
//
// Color+UIColor.swift
// FlinkChallenge
//
// Created by Fernando Martin Garcia Del Angel on 19/02/20.
// Copyright © 2020 Fernando Martin Garcia Del Angel. All rights reserved.
// Color bride created by: https://medium.com/@masamichiueta/bridging-uicolor-system-color-to-swiftui-color-ef98f6e21206
//

import UIKit
import SwiftUI

extension Color {

static var label: Color {
return Color(UIColor.label)
}

static var secondaryLabel: Color {
return Color(UIColor.secondaryLabel)
}

static var tertiaryLabel: Color {
return Color(UIColor.tertiaryLabel)
}

static var quaternaryLabel: Color {
return Color(UIColor.quaternaryLabel)
}

static var systemFill: Color {
return Color(UIColor.systemFill)
}

static var secondarySystemFill: Color {
return Color(UIColor.secondarySystemFill)
}

static var tertiarySystemFill: Color {
return Color(UIColor.tertiarySystemFill)
}

static var quaternarySystemFill: Color {
return Color(UIColor.quaternarySystemFill)
}

static var systemBackground: Color {
return Color(UIColor.systemBackground)
}

static var secondarySystemBackground: Color {
return Color(UIColor.secondarySystemBackground)
}

static var tertiarySystemBackground: Color {
return Color(UIColor.tertiarySystemBackground)
}

static var systemGroupedBackground: Color {
return Color(UIColor.systemGroupedBackground)
}

static var secondarySystemGroupedBackground: Color {
return Color(UIColor.secondarySystemGroupedBackground)
}

static var tertiarySystemGroupedBackground: Color {
return Color(UIColor.tertiarySystemGroupedBackground)
}

static var systemRed: Color {
return Color(UIColor.systemRed)
}

static var systemBlue: Color {
return Color(UIColor.systemBlue)
}

static var systemPink: Color {
return Color(UIColor.systemPink)
}

static var systemTeal: Color {
return Color(UIColor.systemTeal)
}

static var systemGreen: Color {
return Color(UIColor.systemGreen)
}

static var systemIndigo: Color {
return Color(UIColor.systemIndigo)
}

static var systemOrange: Color {
return Color(UIColor.systemOrange)
}

static var systemPurple: Color {
return Color(UIColor.systemPurple)
}

static var systemYellow: Color {
return Color(UIColor.systemYellow)
}

static var systemGray: Color {
return Color(UIColor.systemGray)
}

static var systemGray2: Color {
return Color(UIColor.systemGray2)
}

static var systemGray3: Color {
return Color(UIColor.systemGray3)
}

static var systemGray4: Color {
return Color(UIColor.systemGray4)
}

static var systemGray5: Color {
return Color(UIColor.systemGray5)
}

static var systemGray6: Color {
return Color(UIColor.systemGray6)
}
}
2 changes: 1 addition & 1 deletion FlinkChallenge/FlinkChallenge/Views/CardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct Card: View {

}.padding(.horizontal)
}.padding(.bottom)
.background(Color.white)
.background()
.cornerRadius(10)
.shadow(radius: 5)
}
Expand Down

0 comments on commit dcbdf1c

Please sign in to comment.