Post

Replies

Boosts

Views

Activity

Reply to An app just for a organisation
Not on the "open" Appstore. In addition, do you really want anyone to be able to access those information ? But you could develop for internal use with Apple Business manager: https://developer.apple.com/custom-apps/ Or, how many users (devices for your app) ? If small number, there may be other solutions. But you should first ask yourself if you really need to develop an app ? Or could a web page on organization website do the work ?
Nov ’21
Reply to I want to restrict my app only for iPhones and exclude iPads for installation
AFAIK you cannot prevent installing on iPad, at least in compatibility mode. Then the set up will remain unchanged, just a smaller window. You could test when opening the app if it is iPad. And act accordingly. But take care, depending on what you do not to be rejected during appstore review. However, if setup is optimised for iPhone, have you checked it works on all iPhone formats ? Both in Portrait and landscape ?
Nov ’21
Reply to swift and AppDirectory
I guess //Library means /XXXX/Library ? It is a sandboxed app ? If so, you should then manage the bookmarks. You may read this: https://stackoverflow.com/questions/31278869/ file-access-in-a-sandboxed-osx-app-with-swift I tested in a case (with bookmarks) and got the following documentDirectory: file:///Users/XXXXXXX/Library/Containers/com.yyyyyy.AppName/Data/Documents/ I thought com.yyyyyy.AppName would be the bundle ID, but it is the bundleName. But this directory does not show in my user/Library… I cannot find where it is…
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’21
Reply to Segmentation fault: 11
One possible reason I observed for such a fault is that some TextView, or button, or other are initialized just by x = Button() without frame. This TN could also help you debug: https://developer.apple.com/library/archive/technotes/tn2151/_index.html unable to install xcode 12 Why ? Have you looked for it here https://developer.apple.com/download/all/ Or here: h t t p s : / / xcodereleases.com
Nov ’21
Reply to Update tableView in swift 5
not working when i select a date again What do you expect exactly here ? Note: this is how it looks when reducing by a factor of 4. Still perfectly readable and much easier to follow the thread. In getDateFromCalendar, you do not reload any data in table. So color will not change for visible cells, only when you scroll enough and force a reload.
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’21
Reply to Delegation in Swift
I don't want to fatten my already bloated VC file. Personally, I don't care too much about thiat. As long as the pattern (MVC) is correctly implemented and the model related func are kept apart, the number of lines is not that much of a problem. And the animation of the progressIndicator does fits well inside VC. The point is that you refer to an IBOutlet, hence getting this progressIndicator outside may not be the best. Did you understand the delegation example or do you miss something ?
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’21
Reply to Question about NSWindow exposed or hide
desktop is covered completely by other windows ? Not sure of my interpretation of "completely" ? What you could do is get all the rect of visible windows: let options = CGWindowListOption(arrayLiteral: CGWindowListOption.excludeDesktopElements, CGWindowListOption.optionOnScreenOnly) let windowListInfo = CGWindowListCopyWindowInfo(options, CGWindowID(0)) guard let infoList = windowListInfo as NSArray? as? [[String: AnyObject]] else { return } let rect = infoList[0]["kCGWindowBounds"]! print("rect", rect) var framesRects = [CGRect]() for wind in infoList { let wBounds = wind["kCGWindowBounds"] if wBounds != nil { let x = wBounds!["X"] as? Int ?? 0 let y = wBounds!["Y"] as? Int ?? 0 let width = wBounds!["Width"] as? Int ?? 0 let height = wBounds!["Height"] as? Int ?? 0 let rect = CGRect(x: x, y: y, width: width, height: height) framesRects.append(rect) } } You will get an array such as: frames [(446.0, 648.0, 17.0, 23.0), (1407.0, 0.0, 32.0, 24.0), (3967.0, 0.0, 32.0, 24.0), (3819.0, 0.0, 38.0, 24.0), (3783.0, 0.0, 36.0, 24.0), (4031.0, 0.0, 30.0, 24.0), (3857.0, 0.0, 32.0, 24.0), (3889.0, 0.0, 42.0, 24.0), (3931.0, 0.0, 36.0, 24.0), (3999.0, 0.0, 32.0, 24.0), (4061.0, 0.0, 179.0, 24.0), (1371.0, 0.0, 36.0, 24.0), (1297.0, 0.0, 32.0, 24.0), (1259.0, 0.0, 38.0, 24.0), (1223.0, 0.0, 36.0, 24.0), (1329.0, 0.0, 42.0, 24.0), (1439.0, 0.0, 32.0, 24.0), (1471.0, 0.0, 30.0, 24.0), (1501.0, 0.0, 179.0, 24.0), (1680.0, 0.0, 2560.0, 24.0), (0.0, 0.0, 1680.0, 24.0), (1372.0, 25.0, 0.0, 0.0), (196.0, 513.0, 480.0, 350.0), (64.0, 114.0, 1599.0, 900.0), (1988.0, 79.0, 1566.0, 1025.0), (1959.0, 168.0, 770.0, 753.0), (2663.0, 564.0, 1511.0, 745.0), (90.0, 41.0, 1627.0, 950.0), (1680.0, 25.0, 1344.0, 846.0), (1891.0, 26.0, 1354.0, 808.0), (175.0, 180.0, 1187.0, 836.0), (487.0, 195.0, 1193.0, 855.0), (328.0, 111.0, 1024.0, 820.0)] Then, you have to find the points which are not in one of them. Unfortunately, union of rect is not OK. So you may have to test each point on screen, whether it is in one of those rect. And if there is some out. There may be a better option, but not found so far.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’21
Reply to Question about NSWindow exposed or hide
Don't you care if it the screen is complete occupied by a group of windows ? Or do you just want to know if a single window fully covers screen ? But not necessarily a window from your app ? If so, I see 2 options at least: use  Accessibility API, which can give you access to frame change notifications for all windows, not just your app's. Read here: https://stackoverflow.com/questions/3017636/detect-when-a-mac-os-x-window-is-resized-or-moved Or test regularly (using the code posted in previous answer) if any window is masking the whole screen. PS: for the fun, I managed to compute exactly all the unhidden parts of screen…
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’21
Reply to Update to monterrey beta 2 issue
pc or Mac ?
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to An app just for a organisation
Not on the "open" Appstore. In addition, do you really want anyone to be able to access those information ? But you could develop for internal use with Apple Business manager: https://developer.apple.com/custom-apps/ Or, how many users (devices for your app) ? If small number, there may be other solutions. But you should first ask yourself if you really need to develop an app ? Or could a web page on organization website do the work ?
Replies
Boosts
Views
Activity
Nov ’21
Reply to I want to restrict my app only for iPhones and exclude iPads for installation
AFAIK you cannot prevent installing on iPad, at least in compatibility mode. Then the set up will remain unchanged, just a smaller window. You could test when opening the app if it is iPad. And act accordingly. But take care, depending on what you do not to be rejected during appstore review. However, if setup is optimised for iPhone, have you checked it works on all iPhone formats ? Both in Portrait and landscape ?
Replies
Boosts
Views
Activity
Nov ’21
Reply to swift and AppDirectory
I guess //Library means /XXXX/Library ? It is a sandboxed app ? If so, you should then manage the bookmarks. You may read this: https://stackoverflow.com/questions/31278869/ file-access-in-a-sandboxed-osx-app-with-swift I tested in a case (with bookmarks) and got the following documentDirectory: file:///Users/XXXXXXX/Library/Containers/com.yyyyyy.AppName/Data/Documents/ I thought com.yyyyyy.AppName would be the bundle ID, but it is the bundleName. But this directory does not show in my user/Library… I cannot find where it is…
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to swift and AppDirectory
Close the thread by marking your own answer as correct (click the icon below the 2 arrows).
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Segmentation fault: 11
One possible reason I observed for such a fault is that some TextView, or button, or other are initialized just by x = Button() without frame. This TN could also help you debug: https://developer.apple.com/library/archive/technotes/tn2151/_index.html unable to install xcode 12 Why ? Have you looked for it here https://developer.apple.com/download/all/ Or here: h t t p s : / / xcodereleases.com
Replies
Boosts
Views
Activity
Nov ’21
Reply to Error 2003332927 when accessing AVCaptureDevice?
If this may help in any way: https://developer.apple.com/forums/thread/5278
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to NavigationBar does not display back button and title
Could you the methods you override ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Update tableView in swift 5
You should also reduce the size of the screen captures, that will make the post more readable (use the adjust zize menu in Preview).
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Update tableView in swift 5
not working when i select a date again What do you expect exactly here ? Note: this is how it looks when reducing by a factor of 4. Still perfectly readable and much easier to follow the thread. In getDateFromCalendar, you do not reload any data in table. So color will not change for visible cells, only when you scroll enough and force a reload.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Delegation in Swift
I don't want to fatten my already bloated VC file. Personally, I don't care too much about thiat. As long as the pattern (MVC) is correctly implemented and the model related func are kept apart, the number of lines is not that much of a problem. And the animation of the progressIndicator does fits well inside VC. The point is that you refer to an IBOutlet, hence getting this progressIndicator outside may not be the best. Did you understand the delegation example or do you miss something ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Question about NSWindow exposed or hide
desktop is covered completely by other windows ? Not sure of my interpretation of "completely" ? What you could do is get all the rect of visible windows: let options = CGWindowListOption(arrayLiteral: CGWindowListOption.excludeDesktopElements, CGWindowListOption.optionOnScreenOnly) let windowListInfo = CGWindowListCopyWindowInfo(options, CGWindowID(0)) guard let infoList = windowListInfo as NSArray? as? [[String: AnyObject]] else { return } let rect = infoList[0]["kCGWindowBounds"]! print("rect", rect) var framesRects = [CGRect]() for wind in infoList { let wBounds = wind["kCGWindowBounds"] if wBounds != nil { let x = wBounds!["X"] as? Int ?? 0 let y = wBounds!["Y"] as? Int ?? 0 let width = wBounds!["Width"] as? Int ?? 0 let height = wBounds!["Height"] as? Int ?? 0 let rect = CGRect(x: x, y: y, width: width, height: height) framesRects.append(rect) } } You will get an array such as: frames [(446.0, 648.0, 17.0, 23.0), (1407.0, 0.0, 32.0, 24.0), (3967.0, 0.0, 32.0, 24.0), (3819.0, 0.0, 38.0, 24.0), (3783.0, 0.0, 36.0, 24.0), (4031.0, 0.0, 30.0, 24.0), (3857.0, 0.0, 32.0, 24.0), (3889.0, 0.0, 42.0, 24.0), (3931.0, 0.0, 36.0, 24.0), (3999.0, 0.0, 32.0, 24.0), (4061.0, 0.0, 179.0, 24.0), (1371.0, 0.0, 36.0, 24.0), (1297.0, 0.0, 32.0, 24.0), (1259.0, 0.0, 38.0, 24.0), (1223.0, 0.0, 36.0, 24.0), (1329.0, 0.0, 42.0, 24.0), (1439.0, 0.0, 32.0, 24.0), (1471.0, 0.0, 30.0, 24.0), (1501.0, 0.0, 179.0, 24.0), (1680.0, 0.0, 2560.0, 24.0), (0.0, 0.0, 1680.0, 24.0), (1372.0, 25.0, 0.0, 0.0), (196.0, 513.0, 480.0, 350.0), (64.0, 114.0, 1599.0, 900.0), (1988.0, 79.0, 1566.0, 1025.0), (1959.0, 168.0, 770.0, 753.0), (2663.0, 564.0, 1511.0, 745.0), (90.0, 41.0, 1627.0, 950.0), (1680.0, 25.0, 1344.0, 846.0), (1891.0, 26.0, 1354.0, 808.0), (175.0, 180.0, 1187.0, 836.0), (487.0, 195.0, 1193.0, 855.0), (328.0, 111.0, 1024.0, 820.0)] Then, you have to find the points which are not in one of them. Unfortunately, union of rect is not OK. So you may have to test each point on screen, whether it is in one of those rect. And if there is some out. There may be a better option, but not found so far.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Apple Watch app badminton
Did you search for badminton on appstore ? Issue with watch app here would be the need to enter a lot of data, which may be tedious on Apple Watch.
Replies
Boosts
Views
Activity
Nov ’21
Reply to An alternative Swift method to PHP `pack()` method
I don't know of such method in Swift. If you have just a few formats to support, writing yourself should not be too complex. But the full implementation is certainly more arduous (AFAIK, PHP has not yet covered all the perl spec).
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Question about NSWindow exposed or hide
Don't you care if it the screen is complete occupied by a group of windows ? Or do you just want to know if a single window fully covers screen ? But not necessarily a window from your app ? If so, I see 2 options at least: use  Accessibility API, which can give you access to frame change notifications for all windows, not just your app's. Read here: https://stackoverflow.com/questions/3017636/detect-when-a-mac-os-x-window-is-resized-or-moved Or test regularly (using the code posted in previous answer) if any window is masking the whole screen. PS: for the fun, I managed to compute exactly all the unhidden parts of screen…
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’21