forked from shadowfacts/Tusker
45 lines
1.1 KiB
Swift
45 lines
1.1 KiB
Swift
//
|
|
// ComposeReplyContentView.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 8/22/20.
|
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ComposeReplyContentView: UIViewRepresentable {
|
|
typealias UIViewType = ComposeReplyContentTextView
|
|
|
|
let status: StatusMO
|
|
|
|
@EnvironmentObject var mastodonController: MastodonController
|
|
|
|
let heightChanged: (CGFloat) -> Void
|
|
|
|
func makeUIView(context: Context) -> ComposeReplyContentTextView {
|
|
let view = ComposeReplyContentTextView()
|
|
view.overrideMastodonController = mastodonController
|
|
view.setTextFrom(status: status)
|
|
view.isUserInteractionEnabled = false
|
|
view.backgroundColor = .clear
|
|
|
|
return view
|
|
}
|
|
|
|
func updateUIView(_ uiView: ComposeReplyContentTextView, context: Context) {
|
|
uiView.heightChanged = heightChanged
|
|
}
|
|
}
|
|
|
|
class ComposeReplyContentTextView: StatusContentTextView {
|
|
var heightChanged: ((CGFloat) -> Void)?
|
|
|
|
override func layoutSubviews() {
|
|
super.layoutSubviews()
|
|
|
|
heightChanged?(contentSize.height)
|
|
}
|
|
|
|
}
|