Posts

Post marked as solved
2 Replies
2.2k Views
I have a bunch of Textfields and I want to have the user be able to hit Enter/Next on the keyboard to go through the textfields which are not in a form. They are in multiple views and one is a TextArea which makes certain things not work. I made an example but it seems to refresh the view when the user goes from one textfield to the next, except for at the end. I have this code, please try it out or read it, any suggestions appreciated. import SwiftUI class MyObject: Hashable, Equatable, ObservableObject { public let name: String @Published public var value: String init(name: String, value: String) { self.name = name self.value = value } static func == (lhs: MyObject, rhs: MyObject) -> Bool { return lhs.name == rhs.name } func hash(into hasher: inout Hasher) { hasher.combine(name); hasher.combine(value); } } class MyObjViewModel: ObservableObject { @Published var myObjects: [MyObject] = [] @Published var focus: MyObject? func nextFocus() { guard let focus = focus, let index = self.myObjects.firstIndex(of: focus) else { return } self.focus = myObjects.indices.contains(index + 1) ? myObjects[index + 1] : nil } } struct ContentView: View { @ObservedObject var viewModel = MyObjViewModel() init() { self.viewModel.myObjects.append(contentsOf:[ MyObject(name: "aa", value: "1"), MyObject(name: "bb", value: "2"), MyObject(name: "cc", value: "3"), MyObject(name: "dd", value: "4") ]) } var body: some View { VStack { ForEach(self.viewModel.myObjects, id: \.self) { obj in FocusField(viewModel: viewModel, displayObject: obj) } } } } struct FocusField: View { @ObservedObject var viewModel: MyObjViewModel @ObservedObject var displayObject: MyObject @FocusState var isFocused: Bool var body: some View { TextField("Test", text: $displayObject.value) .onChange(of: viewModel.focus, perform: { newValue in self.isFocused = newValue == displayObject }) .focused(self.$isFocused) .submitLabel(.next) .onSubmit { if self.viewModel.focus == nil { self.viewModel.focus = self.displayObject } print(displayObject.name) self.viewModel.nextFocus() } } }
Posted
by mellis5.
Last updated
.
Post not yet marked as solved
4 Replies
11k Views
Hopefully this is just some user error but it seems that xcodebuild can't find a provisioning profile for the target, I think, which I'll call MyApp, MyApp.app is the target I thinkI updated my provisioning profiles, deleted all and re-added my profiles, checked on the apple dev portal and made sure all is right. I have looked through the build settings and signing info and have not found anything that works or anything to fix that I know of or have been told about by peers. I've cleaned, restarted, tried fastlane, and now I am just using xcodebuild. Here is my error:sudo xcodebuild -exportArchive -exportOptionsPlist "/Users/MyName/MyApp-ios/ExportOptions.plist" -archivePath '/Users/MyName/Library/Developer/Xcode/Archives/2019-02-20/MyApp 2019-02-20 15.34.28.xcarchive' -exportPath "/path/MyApp.ipa" -allowProvisioningUpdates 2019-02-22 09:39:26.044 xcodebuild[15743:239787] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/DEV_2019-02- 22_09-39-26.043.xcdistributionlogs'. error: exportArchive: "MyApp.app" requires a provisioning profile. Error Domain=IDEProvisioningErrorDomain Code=9 ""MyApp.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="MyApp.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}I added MyApp.app and MyApp to my provisioning profile dict and it did not work, I am just trying to build my Development scheme/config. Neither did taking an exportOptions.plist from a successful archive/build using the GUI.ExportOptions<plist version="1.0"> <dict> <key>compileBitcode</key> <false/> <key>destination</key><string>export</string> <key>method</key> <string>enterprise</string> <key>provisioningProfiles</key> <dict> <key>com.mycompany.myappDEV</key> <string>*********UUID**********</string> <key>com.mycompany.myappQA</key> <string>*********UUID**********</string> <key>com.mycompany.myappPROD</key> <string>*********UUID**********</string> </dict> <key>signingCertificate</key> <string>iPhone Distribution</string> <key>signingStyle</key> <string>manual</string> <key>stripSwiftSymbols</key> <true/> <key>teamID</key> <string>XXXXXXXXX</string> <key>thinning</key> <string><none></string> </dict> </plist>How do I set a provisioning profile for my Target? Or what is wrong here.
Posted
by mellis5.
Last updated
.
Post marked as solved
3 Replies
7.3k Views
A stack overflow posts show this problem: https://stackoverflow.com/questions/63652728/swift-ui-hostingcontroller-adds-unwanted-navigation-bar When I add a UIHostingController to my UIKit app it adds a navbar that cannot be removed. This nav bar covers some buttons for me, while other buttons work these ones on the nav bar area on top get blocked but are visible. I tried removing the nav bar on the UIHostingController wrapper, every ViewController, and the SwiftUI Views. Am I missing something? I just want to show a List inside my UIView! Code: UIHostingController Wrapper import UIKit import SwiftUI class ControlledNavigationHostingController<Content>: UIHostingController<AnyView> where Content: View {   public init(shouldShowNavigationBar: Bool, rootView: Content) {     super.init(rootView: AnyView(rootView.navigationBarHidden(!shouldShowNavigationBar)))     navigationController?.isNavigationBarHidden = true   }   @objc required dynamic init?(coder aDecoder: NSCoder) {     fatalError("init(coder:) has not been implemented")   } } My List import SwiftUI struct OverallContentListView: View {       var sections = [0,1,2,3,4]       var body: some View {     NavigationView {         List(sections, id: \.self) { section in Text("TEST")         }     }     .navigationBarTitle("", displayMode: .inline)     .navigationBarHidden(true)   } } UIViewController import UIKit import SwiftUI class TurnoverSplitViewController: UIViewController, ContentDisplayer, StoryboardInstantiable, TurnoverSectionSelectionDelegate {       @IBOutlet weak var contentContainer: UIView!   private var splitContentViewController = ControlledNavigationHostingController(shouldShowNavigationBar: true, rootView: OverallContentListView())            override func viewDidLoad() {     super.viewDidLoad()     navigationController?.isNavigationBarHidden = true     navigationController?.setNavigationBarHidden(true, animated: false)     addContent(child: splitContentViewController, to: contentContainer)   }       override func viewDidAppear(_ animated: Bool) {     navigationController?.setNavigationBarHidden(false, animated: false)     super.viewDidAppear(true)   }    func addContent(child viewController: UIViewController, to: UIView? = nil) {     // Add Child View Controller     addChild(viewController)     // Add Child View as Subview     if let container = to == nil ? contentContainer : to {       container.addSubview(viewController.view)       // Configure Child View       viewController.view.frame = container.bounds       viewController.view.translatesAutoresizingMaskIntoConstraints = true       // Notify Child View Controller       viewController.didMove(toParent: self)     }   } }
Posted
by mellis5.
Last updated
.
Post not yet marked as solved
1 Replies
6.6k Views
Hello, I've emailed Apple's developer support for the third time just now about my company's need to reset our list of development devices. There is a limit of 100 iPads and 100 iPhones and because of things that have already happened we now have new devices we can't use easily and old registered development devices that are somewhere else in the enterprise. How can I get in contact with someone about this? I've spoken to the Apple rep that has come to speak with our development teams and someone else at Apple on the Enterprise Support phone help line. Thanks
Posted
by mellis5.
Last updated
.