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 PhotoPickerDemo: View { | |
@State private var isPresented: Bool = false | |
@State var pickerResult: [UIImage] = [] | |
var config: PHPickerConfiguration { | |
var config = PHPickerConfiguration(photoLibrary: PHPhotoLibrary.shared()) | |
config.filter = .images //videos, livePhotos... | |
config.selectionLimit = 0 //0 => any, set 1-2-3 for hard limit | |
return config | |
} | |
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 PhotoPicker: UIViewControllerRepresentable { | |
let configuration: PHPickerConfiguration | |
@Binding var pickerResult: [UIImage] | |
@Binding var isPresented: Bool | |
func makeUIViewController(context: Context) -> PHPickerViewController { | |
let controller = PHPickerViewController(configuration: configuration) | |
controller.delegate = context.coordinator | |
return controller | |
} | |
func updateUIViewController(_ uiViewController: PHPickerViewController, context: Context) { } |
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
import SwiftUI | |
import PhotosUI | |
struct PhotoPickerDemo: View { | |
@State private var isPresented: Bool = false | |
@State var pickerResult: [UIImage] = [] | |
var config: PHPickerConfiguration { | |
var config = PHPickerConfiguration(photoLibrary: PHPhotoLibrary.shared()) | |
config.filter = .images //videos, livePhotos... | |
config.selectionLimit = 0 //0 => any, set 1-2-3 for har limit |
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
import SwiftUI | |
import UIKit | |
struct ContentView: View { | |
var body: some View { | |
NoSepratorList { | |
Text("Message 1") | |
Text("Message 1") | |
Text("Message 1") | |
Text("Message 1") |
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 ChatBubbleShape: Shape { | |
enum Direction { | |
case left | |
case right | |
} | |
let direction: Direction | |
func path(in rect: CGRect) -> Path { | |
return (direction == .left) ? getLeftBubblePath(in: rect) : getRightBubblePath(in: rect) |
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 ChatBubble<Content>: View where Content: View { | |
let direction: ChatBubbleShape.Direction | |
let content: () -> Content | |
init(direction: ChatBubbleShape.Direction, @ViewBuilder content: @escaping () -> Content) { | |
self.content = content | |
self.direction = direction | |
} | |
var body: some View { | |
HStack { |
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
// | |
// ChatBubble.swift | |
// ios14-demo | |
// | |
// Created by Prafulla Singh on 25/7/20. | |
// | |
import SwiftUI | |
struct ChatBubble<Content>: View where Content: View { | |
let direction: ChatBubbleShape.Direction |