When editing a Swift file in Xcode 12.2, I wanted to change the quotes autocompletion.
For this I looked at the Edit > Substitution menu and selected smartQuotes.
From this point, the whole substitution menu is disabled, no way to enable back.
Opened another file: same issue.
Opened another older version of Xcode: the same.
Opened Xcode 12.2 on another Mac: same thing
How can I re-enable the menu ?
Whilst typing this message, I tried again and the menu is once again reactivated ! I did nothing (at least intentionally).
Was it some type of time out or time required to complete a task ?
But did not return to normal on the other Mac.
But now, 10 more minutes later, it is disabled once again…
That's the type of surprise effect I do dislike in an app…
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
From the Landmarks sample project, I tried a variation, to get two cells side by side in the List.
This is the original with on cell per row as in the tutorial:
struct LandmarkList: View {
		
		var body: some View {
				List(landmarks) { landmark in
						LandmarkRow(landmark: landmark)
				}
		}
}
Surprisingly, the following variation works well to display 2 cells side by side:
struct LandmarkList: View {
		
		var body: some View {
				List (0 ..< (landmarks.count+1)/2) { item in
						LandmarkRow(landmark: landmarks[2*item])
						if 2*item + 1 < landmarks.count {
								LandmarkRow(landmark: landmarks[(2*item)+1])
						}
				}
		}
}
I thus tried to go on and add navigationLinks…
It works when adding a navigation link to the first cell only
struct LandmarkList: View {
		
		var body: some View {
				NavigationView {
						List (0 ..< (landmarks.count+1)/2) { item in
								NavigationLink(destination: LandmarkDetail()) {
										LandmarkRow(landmark: landmarks[2*item])
								}
								if 2*item + 1 < landmarks.count {
										LandmarkRow(landmark: landmarks[(2*item)+1])
								}
						}
						.navigationTitle("Landmarks")	
				}
		}
}
But adding NavigationLink to the second makes it fail:
struct LandmarkList: View {
		
		var body: some View {
				NavigationView {
						List (0 ..< (landmarks.count+1)/2) { item in
								NavigationLink(destination: LandmarkDetail()) {
										LandmarkRow(landmark: landmarks[2*item])
								}
								if 2*item + 1 < landmarks.count {
NavigationLink(destination: LandmarkDetail()) {
										 LandmarkRow(landmark: landmarks[(2*item)+1])
								 }
								}
						}
						.navigationTitle("Landmarks")	
				}
		}
}
The error is on line 3:
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions Is it a normal List behaviour ?
Or did I miss something ?
Which expression could I break ?
I repeat this older thread, as it does not show on the forum with my added post !https://forums.developer.apple.com/message/298938#298938I answered to KMT answer (I read the referenced thread)---------------Looks like that triggered the name change dialog.Can you just right click on the watch name without that happening? Try it on the phone, on the left so see what I'm looking for.Otherwise, this sounds like what others went thru (routine pairing v o o d o o ) in this SO thread - seen it ? [ filter does not like v o o …]https://stackoverflow.com/questions/30792520/in-xcode-i-see-no-paired-apple-watch-even-though-the-watch-is-paired-and-the-w-------------------------So, my question nowI run in the same problem.I just got the Apple Watch (4, OS 5.1.1) and use XCode 10.1. OSX 10.13.6I can create the app + WatchOS on simulator without problem. But not on device.The watch is paired with iPhone.I connect iPhone with USB=> get the message :The iPhone "iPhone XS" can not be used because it requires iTunes 12.9 or later. Do you want to download the latest version of iTunes now?I ignore the message (as I think iTunes 12.9 requires Mojave, isn't it ?). Could it be the problem ???In XCode, I select the scheme iPhone Xs of XXX + Apple Watch of XXXI run, it compiles OK, but at the end says:"Finished running myApp on Apple Watch of XXX" in the XCode barPlus alert:App installation failedThe host is not paired with the device.I have checked in XCode Devices:- on the left, I see iPhoneXS of XXX- but not the Watch- On the right of Devices window, I see the PAIRED WATCHES:Apple Watch of XXXI also checked that Apple Watch is listed with an UDID in the Devices listThe scheme was in Debug mode.So, I changed to release mode, and get the message in Scheme that paired devices not available for debug.So, Compile again, but then get message :Could not launch 'Autonomie' on iPhone XS XXXThere was an error preparing Apple Watch de XXX for development.Try reattaching the device to which Apple Watch de XXX is paired. The device rejected the pairing attempt.So I unpaired the device.ReattachedTruted the hostRun again, just to get again the messageThe host is not paired with the device.I do not see which and where I should pair.
In this app I have a view with 3 textFields or labels on which I have gesture recogniqzers.They work OK.I have localized the app for 2 more languages, and now, when I switxh language (inside the app), I get the following error:2018-02-16 00:19:34.951810+0100 Autonomie[1635:1007703] [Warning] WARNING: A Gesture recognizer (<UITapGestureRecognizer: 0x1757fd90; state = Possible; view = <UITextView 0x17b86600>; target= <(action=autonomieVersionViewTapped:, target=<Autonomie.StartViewController 0x1757f890>)>>) was setup in a storyboard/xib to be added to more than one view (-><UITextView: 0x17ba8000; frame = (60.5 50; 198 25); text = 'version 0.5 © AlphaNums 2...'; clipsToBounds = YES; hidden = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x175e25d0>; layer = <CALayer: 0x175da320>; contentOffset: {0, 0}; contentSize: {198, 31}>) at a time, this was never allowed, and is now enforced. Beginning with iOS 9.0 it will be put in the first view it is loaded into.<UIButtonLabel: 0x176d3da0; frame = (160 18; 0 0); text = 'Calcular el rango …'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x176d01c0>><UIButtonLabel: 0x1765cc40; frame = (160 18; 0 0); text = 'Calculer autonomie …'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1765cda0>>And gestures do not work.If I switch back to the original language, everything OK.
When compiling this OSX App in XCode 10 beta 2 (Swift 4.2), I get a warning that did not show in XCode 9.4 each time I create an NSConstraint programmaticallyInstance will be immediately deallocated because property 'myConstraint' is 'weak'fileprivate weak var myConstraint : NSLayoutConstraint!
myConstraint = NSLayoutConstraint(item: aButton, attribute: .top, relatedBy: .equal, toItem: aView, attribute: .bottom, multiplier: 1.0, constant: 30)However, there is no such warning for IBOutlet@IBOutlet fileprivate weak var anotherConstraint : NSLayoutConstraint!Is it a just a new warning for an error that existed before ? Or did something change in NSConstraint ?Should I treat IBOutlet and programmatically created differently with respect to weak ?
The new forum has been there for a week now.
I did wait to get accustomed to it so that my comments are not just due to the change factor.
I think it is now possible to make some assessment and I would appreciate others’ opinion to see if it is just me…
There are some good points: the editor is much less whimsical
the possibility to tag topic is a good thing
search has improved (a little).
But I find really frustrating points: Editor is better and has a live Preview. What a strange concept in the world of the inventor of WYSIWYG ! Did we return to the 90’s editors with their control characters ?
Tags are good, but IMHO it would be useful to have major and minor tags. That would help focus when we list threads by tag by making it possible to select only the major one
All posts are now reviewed to avoid spam. Good enough. But why can it take hours (in a case, already 5 hours and still in review) for a very simple answer post (no URL, no bizarre word) to be reviewed. A bit frustrating. And that does not allow for any rapidly going discussion.
Many features seem to be inspired from SO, but without some critical capabilities, as the inclusion of images.
The concept of upvote or downvote has been introduced as well. Was it really needed ? Won’t it lead to some regrettable side effects that we see in SO where some do not dare propose an answer or even ask a question for fear of a negative vote ? That’s particularly the case for anyone not very fluent in english who may not express properly his/her opinion. I did find that previous developers forum was a more welcoming place than SO. Hope that will not change.
There are also capabilities that are missing from previous forum (unless they are so well hidden I could not find them): because of increased spacing, there are now just 15 instead 25 posts per page. And you have to scroll a lot more to get at the end of the shorter list. That do slow down the screening.
how can one see the threads he contributed to ? Seems we can only filter the one we authored.
It seems now quasi impossible to edit a post, and of course delete it.
So at the end, instead of the whaooh effect I was expecting I have just a mixed feeling.
Using AVSpeechSynthesizer, I noticed that some works in UPPERCASe are not correctly spoken.
SMALL is pronounced small
but WIDTH is pronounced W-I-D-T-H
I reproduced the problem in playground:
let sentence = "Hello everyone. Two minutes to go. SMALL WIDTH." let synthesizer = AVSpeechSynthesizer()
let utterance = AVSpeechUtterance(string: sentence)
utterance.voice = AVSpeechSynthesisVoice(
&#9;language: "en-GB"
)
utterance.rate = AVSpeechUtteranceDefaultSpeechRate * 1.05
synthesizer.speak(utterance)
Is it the expected behaviour ?
Just installed XCode 10.I receive the following warning:2018-06-05 13:25:47.686865+0200 simpleTest[14581:1428592] libMobileGestalt MobileGestalt.c:875: MGIsDeviceOneOfType is not supported on this platform.Cannot find what MGIsDeviceOneOfType is about.Edited : is it related to Mapping and Geographical Information System (“MGIS”) ?
One of my production Mac is still on Mojave. I want to update to Catalina and not Big Sur (waiting for dust to settle down).
Automatic update from system preferences only proposes Big Sur as well as some patch updates for MacOS 10.14.6
What is the safe and sure way to update from Mojave to the latest Catalina ?
I have created a new entry in the capability list (background modes)
None is selected, so that seems to have no effect.
However, I would like to remove this entry to clean the screen. But I cannot find any "-" button, nor contextual menu, nor editing in XML…
Is it simply possible to remove ?
Learning Widgets, I try a simple pattern: get a textField in the app;
have the Widget updated when textField is changed.
App is UIKit.
Widget has No "included Configuration Intent".
It compiles and works. Widget is updated every 5 minutes as asked line 23 (final snippet).
But the message is never updated (line 48 of final snippet) with globalToPass (as expected from line 24): it always shows "Hello".
What I tried: Create a singleton to hold the data to pass:
class Util {
		
		class var shared : Util {
				struct Singleton {
						static let instance = Util()
				}
				return Singleton.instance;
		}
		
		var globalToPass = "Hello"
}
shared the file between the 2 targets App and WidgetExtension
In VC, update the singleton when textField is changed and ask for widget to reload timeline
		@IBAction func updateMessage(_ sender: UITextField) {
				
				Util.shared.globalToPass = valueToPassLabel.text ?? "--"
				WidgetCenter.shared.reloadTimelines(ofKind: "WidgetForTest")
				WidgetCenter.shared.reloadAllTimelines()
		}
Problem : Widget never updated its message field
Probably I need to have the message in @State var, but I could not get it work.
Here is the full widget code at this time:
import WidgetKit
import SwiftUI
struct LoadStatusProvider: TimelineProvider {
		
		func placeholder(in context: Context) -> SimpleEntry {
				
				SimpleEntry(date: Date(), loadEntry: 0, message: Util.shared.globalToPass)
		}
		func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
				
				let entry = SimpleEntry(date: Date(), loadEntry: 0, message: Util.shared.globalToPass)
				completion(entry)
		}
		func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
				var entries: [SimpleEntry] = []
				// Generate a timeline consisting of five entries an hour apart, starting from the current date.
				let currentDate = Date()
				for minuteOffset in 0 ..< 2 {
						let entryDate = Calendar.current.date(byAdding: .minute, value: 5*minuteOffset, to: currentDate)!
						let entry = SimpleEntry(date: entryDate, loadEntry: minuteOffset, message: Util.shared.globalToPass)
						entries.append(entry)
				}
				let timeline = Timeline(entries: entries, policy: .atEnd)
				completion(timeline)
		}
}
struct SimpleEntry: TimelineEntry {
		let date: Date
		let loadEntry: Int
		let message: String
}
struct WidgetForTestNoIntentEntryView : View {
		var entry: LoadStatusProvider.Entry
		var body: some View {
				let formatter = DateFormatter()
				formatter.timeStyle = .medium
				let dateString = formatter.string(from: entry.date)
				return
						VStack {
								Text(String(entry.message))
								HStack {
										Text("Started")
										Text(entry.date, style: .time)
								}
								HStack {
										Text("Now")
										Text(dateString)
								}
								HStack {
										Text("Loaded")
										Text(String(entry.loadEntry))
								}
						}
		}
}
@main
struct WidgetForTestNoIntent: Widget {
		let kind: String = "WidgetForTestNoIntent"
		var body: some WidgetConfiguration {
				StaticConfiguration(kind: kind, provider: LoadStatusProvider()) { entry in
						WidgetForTestNoIntentEntryView(entry: entry)
				}
				.configurationDisplayName("My Widget")
				.description("This is an example widget.")
		}
}
struct WidgetForTestNoIntent_Previews: PreviewProvider {
		static var previews: some View {
				
				WidgetForTestNoIntentEntryView(entry: SimpleEntry(date: Date(), loadEntry: 0, message: "-"))
						.previewContext(WidgetPreviewContext(family: .systemSmall))
		}
}
I have not defined extension for IntentHandler
I consider the following distribution scheme for some Mac App: distribute the commercial (paying) version on Appstore
propose a free demo version (of course limited in some aspects) on a web site. This would of course be notarised.
The reason is to avoid having several versions on the Appstore which could create some confusion. The 2 versions would have similar names and differ essentially in the size of data they can handle.
Does anyone know if this is authorised by the Appstore Guidelines ? Or must I publish both on the AppStore ? Is there a risk my app being rejected as spam ?
In a MacOS App: When I create a file (in a folder), I save a security bookmark for the file.
if I ask user to authorise its folder (before creating the file in it), I can save its bookmark too, allowing to create other files in this folder.
So, when I create a file and need to create a companion (eg, a Results file), I first ask access to the folder, then create the file and create the results file in the same folder (hence having sandbox authorisation).
My understanding is that it is not possible to programmatically create and save the folder bookmark, after deriving its url from the file url, without requesting user to explicitly grant access (with NSOpen panel) ? Which would be very logical as it would deny the goal of security bookmarks.
So, is user explicit authorisation required (logical but creates more complexity when user moves files in the Finder).
Note: In fact don't really need it, as I save bookmark for every accessed file, but I would like to know.
We have been waiting for this for many years.
And the icon is there, at the right most
That's a GREAT plus for the forum.
I suspect this point has been discussed in length, but I would like to find some reference to the design logic behind some Swift key aspect : the assignment operator, by value or reference.
We know well how = works, depending it deals with reference or value (knowing the consequence of misuse) and the difference between the 2 :
class AClass {
var val: Int = 0
}
struct AStruct {
var val : Int = 0
}
let aClass = AClass()
let bClass = aClass
bClass.val += 10
print("aClass.val", aClass.val, "bClass.val", bClass.val)
let aStruct = AStruct()
var bStruct = aStruct
bStruct.val += 10
print("aStruct.val", aStruct.val, "bStruct.val", bStruct.val)
Hence my question.
Was it ever considered to have 2 operators, one used to assign reference and the other to assign value?
Imagine we have :
= operator when dealing with references
:= operator when dealing with content.
Then
let bClass = aClass
would remain unchanged.
But
var bStruct = aStruct
would not be valid anymore, with a compiler warning to replace by
var bStruct := aStruct
On the other end, we could now write
let bClass := aClass
to create a new instance and assign another instance content, equivalent to convenience initialiser
class AClass {
var val: Int = 0
init(with aVar: AClass) {
self.val = aVar.val
}
init() {
}
}
called as
let cClass = AClass(with: aClass)
But the 2 operators would have made it clear that when using = we copy the reference. When using := we copy content.
I do think there is a strong rationale behind the present design choice (side effects I do not see ?), but I would appreciate to better understand which.