title: LayoutConstraints Changing the translatesAutoresizingMaskIntoConstraints
body: <p>I create a simple share button to share some texts. Although the ShareSheet is working, I received unexpected errors messages in my console. I am a beginner level and I have no idea whether should I worry about the error message. Please let me know if there is a better solution for ShareSheet.
  The messages are</p>
  <pre><code>2021-11-22 19:36:03.677822-0500 ZSV5_IDChange[8282:264096] [LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: &lt;_UIActivityContentFooterView: 0x7feec8925ad0; baseClass = UICollectionReusableView; frame = (16 256; 358 52); layer = &lt;CALayer: 0x6000038ec4c0&gt;&gt;
  2021-11-22 19:36:03.688591-0500 ZSV5_IDChange[8282:264096] [default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.)
  2021-11-22 19:36:03.859368-0500 ZSV5_IDChange[8282:264096] [UICollectionViewRecursion] cv == 0x7feec7065a00 Disabling recursion trigger logging
  </code></pre>
  <p>Also, I get UIApplication.shared.windows will deprecate in iOS 15. If it is true, I think it will be a smarter choice to use ShareSheet() instead of using private func shareText(text: String). Please have a look at my code before I overcomplicated my question.</p>
  <p>Below is my simple code:</p>
  <pre><code>import Foundation
  import SwiftUI
  
  struct DataArray: Identifiable {
      let id: Int
      let cities: String
      let name1: String
      let name2: String
      
      let isFavorite: Bool
  }
  
  public struct ListDataArray {
      static let dot = [
      DataArray(id: 1,
          cities: &quot;Baltimore&quot;
          name1: &quot;John&quot;,
          name2: &quot;Mike&quot;,
          isFavorite: False),
          
      DataArray(id: 2,
          cities: &quot;Frederick&quot;),
          name1: &quot;Joe&quot;,
          name2: &quot;Swift&quot;,
          isFavorite: False),
          
      DataArray(id: 3,
          cities: &quot;Catonsville&quot;
          name1: &quot;Susan&quot;,
          name2: &quot;Oliver&quot;,
          isFavorite: False),
          
      // There will be a lot of data     
      ]
  }
  
  struct TestShareSheet3: View {
      
      var data: DataArray
      @State private var showShareSheet: Bool = false
      
      var body: some View {
          VStack {
              
              Button {
                  
                  self.showShareSheet.toggle()
                  
                  //shareText(text: &quot;\(data.cities)\n\(data.name1) - \(data.name2)&quot;)
                                  
              } label: {
                  Text(&quot;Share&quot;)
                      .foregroundColor(.blue)
                      .font(.title3)
                      .padding()
                      .background(Color.green)
                      .cornerRadius(10)
              }
              .sheet(isPresented: self.$showShareSheet) {
                  // On Dismiss
              } content: {
                  ShareSheet(activityItems: [&quot;\(data.cities)\n\(data.name1) - \(data.name2)&quot;])
              }
  
          }
      }
      
      // This function also has the same issue
      private func shareText(text: String) {
          let av = UIActivityViewController(activityItems: [text], applicationActivities: nil)
          UIApplication.shared.windows.first?.rootViewController?.present(av, animated: true, completion: nil)
          if UIDevice.current.userInterfaceIdiom == .pad {
              av.popoverPresentationController?.sourceView = UIApplication.shared.windows.first
              av.popoverPresentationController?.sourceRect = CGRect(x: UIScreen.main.bounds.width / 2.1, y: UIScreen.main.bounds.height / 1.3, width: 200, height: 200)
          }
      }
  }
  
  struct Test2_Previews: PreviewProvider {
      static var previews: some View {
          // Testing purposes
          TestShareSheet3(data: ListDataArray.dot[1])
      }
  }
  
  struct ShareSheet: UIViewControllerRepresentable {
          
      typealias Callback = (_ activityType: UIActivity.ActivityType?, _ completed: Bool, _ returnedItems: [Any]?, _ error: Error?) -&gt; Void
      
      let activityItems: [Any]
      let applicationActivities: [UIActivity]? = nil
      let excludedActivityTypes: [UIActivity.ActivityType]? = nil
      let callback: Callback? = nil
      
      func makeUIViewController(context: Context) -&gt; UIActivityViewController {
          let controller = UIActivityViewController(
              activityItems: activityItems, applicationActivities: applicationActivities)
          controller.excludedActivityTypes = excludedActivityTypes
          controller.completionWithItemsHandler = callback
          return controller
      }
      
      func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {  }
  }
  </code></pre>