Would you provide a sample code?
Post
Replies
Boosts
Views
Activity
As today works only with navigationViewStyle using column, or automatic, on iPad started in landscape, I filed a Feedback in Feedback Assistant with a sample project.
Ok. Quit/re open Xcode shouldn't be necessary; perhaps a deeper analysis by Apple with a Feedback Assistant could help.
If developer option lastly appears after running an app from Xcode, please set above as valid answer for who will read.
Developer option are activated running an App from Xcode and disappears turning off the iPhone.
Are you in this situation?
Perhaps the fix has been implemented in Xcode 12.5 Beta 3:
Resolved Issues
Fixed an issue that caused OS X 10.11 and earlier to reject packages signed on OS X 10.11 and earlier. (71695608)
Known Issues
OS X 10.11 and earlier may reject code signatures added to universal binaries by Xcode 12.5. (70724583) (FB8830007)
Workaround: Specify --digest-algorithm=sha1,sha256 to the codesign utility at signing time. In Xcode, specify this using the OTHER_CODE_SIGN_FLAGS build setting.
I understood that you would a single click on the "+" button create a new List's item and follows its link.
If it is so the NavigationLink init has to be the one with a tag and reference to a tags' selection, the addJob function have to create the new job's item and set the reference to point to it.
The simplified code below use an, improper, set of Int as job's ID.
import SwiftUI
struct ContentView: View {
var body: some View {
JobsView()
}
}
extension Int: Identifiable
{
public var id: Self { self }
}
struct JobsView: View {
@State private var jobs = [0, 1, 2]
@State private var selection: Int? = nil
var body: some View {
NavigationView {
List {
ForEach(jobs) { job in
NavigationLink("job \(job)",
destination: JobOverView(job: job),
tag: job,
selection: $selection)
}
}
.toolbar {
Button(action: addJob,
label: {Image(systemName:"plus")}
)
}
.navigationTitle("Jobs")
}
}
private func addJob() {
jobs.append(jobs.last!+1)
selection = jobs.last
}
}
struct JobOverView: View {
let job: Int
var body: some View {
Label("Job Info \(job)", systemImage: "chevron.down.circle.fill")
}
}
In my case I restored from iCloud as well as from iMac backup and both worked.
Anyway the restoration don't change the iPhone boot, so in case of a failure (perhaps a power loss) the restore could be done again.
The restore from a full, password protected, backup in iMac restored also sensitive data as passwords and fingerprints, in either case password will be re-synched from iCloud, if the were there, and fingerprints have to be re-recorded.
I found that List in a ScrollView works only if it don't use the entire space.
GeometryReader
{ (geometry) in
ScrollView()
{
let w = geometry.size.width
let h = geometry.size.height
List
{
....
}
.frame(width: w>0.1 ? w-0.1 : 0, height: h>0.1 ? h-0.1 : 0)
}
}
DocumentGroup(
newDocument:
{ () -> MyDocumentClass in
return MyDocumentClass() // Create a new document
},
editor:
{ (file: ReferenceFileDocumentConfiguration<MyDocumentClass>) -> FieldViewWrapper in
file.document.url = file.fileURL // Now get the url
ContentView() // View/Edit the document
}
)
Using Reference File Document Group followed by NavigationView I've been able to have a document group that open a navigation view, which have the sidebar.
Here an extract:
import SwiftUI
@main
struct MyApp: App
{
var body: some Scene
{
DocumentGroup(newDocument:
{ () -> myDocumentClass in // Create a new document
return myDocumentClass()
},
editor:
{ (file: ReferenceFileDocumentConfiguration<myDocumentClass>) -> ContentView in
return ContentView()
}
)
}
}
class myDocumentClass: ReferenceFileDocument
{
typealias Snapshot = ContentView
var myData: Snapshot
...
}
struct ContentView: View
{
var body: some View
{
NavigationView
{
sideBar()
mainView()
}
.navigationViewStyle(DoubleColumnNavigationViewStyle())
}
}
I have the same issue, and studied various solutions. In my opinion 'preferredFilename' seems be the best, in theory. unfortunately currently even I didn't found a working solution.
With Xcode12.2 beta (12B5018i) I don't have anymore the issue. It should be resolved.
I found by myself that is possible since on iOS 14.
func encode(to encoder: Encoder) throws
{
var container = encoder.container(keyedBy: CodingKeys.self)
if #available(iOS 14.0, *)
{
let convertedColor = UIColor(mycolor)
let colorData = try NSKeyedArchiver.archivedData(withRootObject: convertedColor, requiringSecureCoding: false)
try container.encode(colorData, forKey: .color)
} else
{
// Fallback on earlier versions
}
}
Code 12 beta 3 fixed the issue.
Xcode 11.6 Beta is currently, June 23 2020, the only one supporting iOS 13.6