Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
enzevalos_iphone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
enzevalos
enzevalos_iphone
Commits
81481ea8
Commit
81481ea8
authored
4 years ago
by
Aylin
Browse files
Options
Downloads
Patches
Plain Diff
Committing ImagePicker
parent
07363316
Branches
Branches containing commit
No related tags found
1 merge request
!83
Resolve "Integrate attachment functionality in new ComposeView"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
enzevalos_iphone/SwiftUI/Compose/ImagePicker.swift
+45
-0
45 additions, 0 deletions
enzevalos_iphone/SwiftUI/Compose/ImagePicker.swift
with
45 additions
and
0 deletions
enzevalos_iphone/SwiftUI/Compose/ImagePicker.swift
0 → 100644
+
45
−
0
View file @
81481ea8
//
// ImagePicker.swift
// enzevalos_iphone
//
// Created by Aylin Akkus on 26.03.21.
// Copyright © 2021 fu-berlin. All rights reserved.
/// This file is a SwiftUI wrapper for UIImagePickerController
/// it can be used it to attach pictures to a mail and preview them
import
SwiftUI
struct
ImagePicker
:
UIViewControllerRepresentable
{
@Environment
(\
.
presentationMode
)
var
presentationMode
@Binding
var
image
:
UIImage
?
var
xy
=
3
class
Coordinator
:
NSObject
,
UINavigationControllerDelegate
,
UIImagePickerControllerDelegate
{
let
parent
:
ImagePicker
init
(
_
parent
:
ImagePicker
)
{
self
.
parent
=
parent
}
func
imagePickerController
(
_
picker
:
UIImagePickerController
,
didFinishPickingMediaWithInfo
info
:
[
UIImagePickerController
.
InfoKey
:
Any
])
{
if
let
uiImage
=
info
[
.
originalImage
]
as?
UIImage
{
parent
.
image
=
uiImage
}
parent
.
presentationMode
.
wrappedValue
.
dismiss
()
}
}
func
makeCoordinator
()
->
Coordinator
{
Coordinator
(
self
)
}
func
makeUIViewController
(
context
:
UIViewControllerRepresentableContext
<
ImagePicker
>
)
->
UIImagePickerController
{
let
picker
=
UIImagePickerController
()
return
picker
}
func
updateUIViewController
(
_
uiViewController
:
UIImagePickerController
,
context
:
UIViewControllerRepresentableContext
<
ImagePicker
>
)
{
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment