Hello,
I am new to app development. I am trying to make an iMessage app. I created it and then added a SwiftUI view. It builds just fine and the view is visible on the storyboard, but the app is not present in iMessage on Simulator or on an actual device. What's wrong?
Thanks for any help.
import UIKit
import Messages
import SwiftUI
class MessagesViewController: MSMessagesAppViewController {
var hostingController: UIHostingController<CalendarView>?
override func viewDidLoad() {
super.viewDidLoad()
}
override func willBecomeActive(with conversation: MSConversation) {
super.willBecomeActive(with: conversation)
let swiftUIView = CalendarView()
let hostingController = UIHostingController(rootView: swiftUIView)
addChild(hostingController)
view.addSubview(hostingController.view)
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), hostingController.view.topAnchor.constraint(equalTo: view.topAnchor), hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)])
hostingController.didMove(toParent: self)
self.hostingController = hostingController
}
override func didResignActive(with conversation: MSConversation) {}
override func didReceive(_ message: MSMessage, conversation: MSConversation) {}
override func didStartSending(_ message: MSMessage, conversation: MSConversation) {}
override func didCancelSending(_ message: MSMessage, conversation: MSConversation) {}
override func willTransition(to presentationStyle: MSMessagesAppPresentationStyle) {}
override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {}
}