-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from estivensh4/develop
Develop
- Loading branch information
Showing
19 changed files
with
235 additions
and
63 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
14 changes: 14 additions & 0 deletions
14
example/iosApp/iosApp.xcworkspace/xcshareddata/swiftpm/Package.resolved
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "kmm-viewmodel", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/rickclephas/KMM-ViewModel.git", | ||
"state" : { | ||
"branch" : "master", | ||
"revision" : "5122024085c468d006c66afc3ae37f233f88ec1f" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,83 @@ | ||
import SwiftUI | ||
import shared | ||
import KMMViewModelSwiftUI | ||
import PhotosUI | ||
|
||
@available(iOS 16.0, *) | ||
struct ContentView: View { | ||
var greet = "Hi" | ||
|
||
@StateViewModel var sampleViewModel = SampleViewModel() | ||
let bucketName = "test-bucket-desktop-app" | ||
let key = "test.jpg" | ||
@State private var selectedItem: PhotosPickerItem? = nil | ||
@State private var selectedImageData: Data? = nil | ||
|
||
var body: some View { | ||
Text(greet) | ||
PhotosPicker( | ||
selection: $selectedItem, | ||
matching: .images, | ||
photoLibrary: .shared()) { | ||
Text("Select a photo") | ||
} | ||
.onChange(of: selectedItem) { newItem in | ||
Task { | ||
// Retrieve selected asset in the form of Data | ||
if let data = try? await newItem?.loadTransferable(type: Data.self) { | ||
selectedImageData = data | ||
} | ||
} | ||
} | ||
|
||
if let selectedImageData, | ||
let uiImage = UIImage(data: selectedImageData) { | ||
Image(uiImage: uiImage) | ||
.resizable() | ||
.scaledToFit() | ||
.frame(width: 250, height: 250) | ||
} | ||
|
||
|
||
VStack { | ||
List { | ||
ForEach(sampleViewModel.bucketList, id: \.name){ data in | ||
Text(data.name ?? "Default value") | ||
} | ||
} | ||
Text("Status bucket: \(sampleViewModel.bucket)") | ||
Text("Status generate presigned url: \(sampleViewModel.generatePresignedUrl)") | ||
Button(action: { | ||
sampleViewModel.createBucket(bucketName: bucketName) | ||
}, label: { | ||
Text("Create bucket") | ||
}) | ||
Button(action: { | ||
sampleViewModel.listBuckets() | ||
}, label: { | ||
Text("List bucket") | ||
}) | ||
Button(action: { | ||
sampleViewModel.deleteBucket(bucketName: bucketName) | ||
}, label: { | ||
Text("Delete bucket") | ||
}) | ||
Button(action: { | ||
sampleViewModel.generatePresignedUrl(bucketName: bucketName, key: key) | ||
}, label: { | ||
Text("Generate presigned URL") | ||
}) | ||
|
||
Button(action: { | ||
|
||
if let selectedImageData, | ||
let uiImage = UIImage(data: selectedImageData) { | ||
sampleViewModel.putObject(bucketName: bucketName, key: key, imageFile: uiImage) | ||
} | ||
|
||
|
||
}, label: { | ||
Text("Put object") | ||
}) | ||
} | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// KMMViewModel.swift | ||
// iosApp | ||
// | ||
// Created by Estiven on 16/11/23. | ||
// Copyright © 2023 orgName. All rights reserved. | ||
// | ||
|
||
import KMMViewModelCore | ||
import shared | ||
|
||
extension Kmm_viewmodel_coreKMMViewModel: KMMViewModel { } |
Oops, something went wrong.