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
import SwiftUI | |
import PlaygroundSupport | |
struct Screen: View { | |
@State var size: CGSize = .zero | |
var body: some View { | |
//Lets Start with our Tinder Home Screen Recreate | |
//First, we need entire background to be gray-ish color. ZStack puts different views on top of each other. | |
ZStack { |
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
struct Breathe: View { | |
@State var scale = false | |
@State var rotate = false | |
var body: some View { | |
ZStack { | |
Group { | |
ZStack { | |
Circle().frame(width: 80, height: 80).foregroundColor(Color(UIColor.systemBlue)).offset(y: -42) | |
Circle().frame(width: 80, height: 80).foregroundColor(Color(UIColor.systemBlue)).offset(y: 42) |
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
import SwiftUI | |
import PlaygroundSupport | |
struct Screen: View { | |
var body: some View { | |
ScrollView { | |
HStack { | |
VStack (alignment: .leading) { | |
Text("TUESDAY, MAY 12").foregroundColor(.secondary).bold().font(.footnote) | |
Text("Today").font(.largeTitle).bold() |
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
import SwiftUI | |
import PlaygroundSupport | |
struct Screen: View { | |
init() { | |
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor.systemBlue] | |
UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: UIColor.systemBlue] | |
} | |
@State var tasks = ["Meal Prep", "Call Family", "Do Laundry"] | |
var body: some View { |
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
struct ImageContentView : View { | |
@State var url = "https://link-to-image" | |
var body: some View { | |
VStack { | |
ImageView(url: url) | |
} | |
} |
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
import Combine | |
import SwiftUI | |
struct ImageViewController: View { | |
@ObservedObject var url: LoadUrlImage | |
init(imageUrl: String) { | |
url = LoadUrlImage(imageURL: imageUrl) | |
} | |
var body: some View { |
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
class RemoteImageModel: ObservableObject { | |
@Published var displayImage: UIImage? | |
var imageUrl: String? | |
var cachedImage = CachedImage.getCachedImage() | |
init(imageUrl: String?) { | |
self.imageUrl = imageUrl | |
if imageFromCache() { | |
return | |
} |
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
struct ImageUrlView: View { | |
@ObservedObject var remoteImageModel: RemoteImageModel | |
init(url: String?) { | |
remoteImageModel = RemoteImageModel(imageUrl: imageUrl) | |
} | |
var body: some View { | |
Image(uiImage: remoteImageModel.image ?? UIImage(named: "default-image-here")!) | |
.resizable() |
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
Network.shared.apollo.perform(mutation: CreatePersonMutation(input: personInput)) { result in | |
switch result { | |
case .success(let graphQLResult): | |
print(graphQLResult) | |
case .failure(let error): | |
print("Failure! Error: \(error)") | |
} | |
} |
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
Network.shared.apollo.fetch(query: ListPersonQuery) { result in | |
switch result { | |
case .success(let graphQLResult): | |
if let items = graphQLResult.data?.listPerson?.items { | |
for conf in items { | |
if let curPerson = conf { | |
//Do whatever here with your Graphql Result | |
print(curPerson) | |
} | |
} |
NewerOlder