mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-03-22 01:19:29 +01:00
Add examples project
This commit is contained in:
36
Examples/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryView.swift
Executable file
36
Examples/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryView.swift
Executable file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// RepositoryView.swift
|
||||
// GitHubSearchWithSwiftUI
|
||||
//
|
||||
// Created by marty-suzuki on 2019/06/05.
|
||||
// Copyright © 2019 jp.marty-suzuki. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RepositoryView : View {
|
||||
|
||||
let repository: Repository
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
|
||||
HStack {
|
||||
Image(systemName: "doc.text")
|
||||
Text(repository.fullName)
|
||||
.bold()
|
||||
}
|
||||
|
||||
// Show text if description exists
|
||||
repository.description
|
||||
.map(Text.init)?
|
||||
.lineLimit(nil)
|
||||
|
||||
HStack {
|
||||
Image(systemName: "star")
|
||||
Text("\(repository.stargazersCount)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user