This file contains hidden or 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
| // https://stackoverflow.com/questions/56784722/swiftui-send-email | |
| public struct MailView: UIViewControllerRepresentable { | |
| @Environment(\.presentationMode) var presentation | |
| @Binding var result: Result<MFMailComposeResult, Error>? | |
| public var configure: ((MFMailComposeViewController) -> Void)? | |
| public class Coordinator: NSObject, MFMailComposeViewControllerDelegate { | |
| @Binding var presentation: PresentationMode |
This file contains hidden or 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 SingleSelectionList<Item: Identifiable, Content: View>: View { | |
| var items: [Item] | |
| @Binding var selectedItem: Item? | |
| var rowContent: (Item) -> Content | |
| var body: some View { | |
| List(items) { item in | |
| rowContent(item) | |
| .modifier(CheckmarkModifier(checked: item.id == self.selectedItem?.id)) |
This file contains hidden or 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 ChatMessage: Identifiable { | |
| var id = UUID() | |
| var user: ChatUser | |
| var messageKind: ChatMessageKind | |
| var isSender: Bool | |
| var date: Date | |
| } |
This file contains hidden or 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
| enum ImageLoadingKind { | |
| case local(UIImage) | |
| case remote(URL) | |
| } | |
| enum ChatMessageKind { | |
| case text(String) | |
| case image(ImageLoadingKind) | |
| case location(LocationItem) | |
| case contact(ContactItem) |
This file contains hidden or 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 ChatUser: Identifiable { | |
| var id = UUID() | |
| var userName: String | |
| var avatar: UIImage? | |
| } |
This file contains hidden or 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 PacMan: Shape { | |
| var endAngle: Angle | |
| // SwiftUI bu parametre ile, | |
| // gerekli optimizasyonu yapıyor. | |
| var animatableData: Double { | |
| get { endAngle.degrees } | |
| set { endAngle = .degrees(newValue) } | |
| } |
This file contains hidden or 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
| HStack(spacing: 16) { | |
| // 1 | |
| Rectangle() | |
| .fill(Color.orange) | |
| .frame(width: 60, height: 60) | |
| // 2 | |
| Rectangle() | |
| .stroke( |
This file contains hidden or 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 Triangle: Shape { | |
| func path(in rect: CGRect) -> Path { | |
| var path = Path() | |
| // Orta - Üst | |
| let topCenter = CGPoint(x: rect.midX, y: rect.minY) | |
| path.move(to: topCenter) | |
| // Sol Kenar | |
| path.addLine(to: .init(x: rect.minX, y: rect.maxY)) |
This file contains hidden or 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 Balon: Shape { | |
| func path(in rect: CGRect) -> Path { | |
| // Orta - Alt nokta | |
| let bottomCenter = CGPoint(x: rect.midX, y: rect.maxY) | |
| // Orta - Üst nokta | |
| let upCenter = CGPoint(x: rect.midX, y: rect.minY) | |
This file contains hidden or 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
| HStack { | |
| PacMan(endAngle: .degrees(270)) | |
| .frame(width: 120, height: 120) | |
| // PacMan için, içerisinde çizim yaptığımız | |
| // (in rect: CGRect) bu frame' dir. | |
| PacMan(endAngle: .degrees(270)) | |
| .rotation(.degrees(45)) | |
| .frame(width: 120, height: 120) |
NewerOlder