Questions tagged [foundation]

Foundation is a framework written in Objective-C that implements many useful classes and functions. For the responsive front-end framework Zurb Foundation, please use the tag [zurb-foundation].

Filter by
Sorted by
Tagged with
-1 votes
1 answer
49 views

Does PropertyListEncoder no longer support binary property list encoding?

Edit: The question below incorrectly assumes that because BBEdit displays a property list in XML format, the file actually IS an XML-format plist. It turns out that BBEdit quietly converts binary ...
Duncan C's user avatar
  • 129k
0 votes
1 answer
38 views

Xcode downloads client crash reports for string interpolation (_StringGuts.append)

Xcode contains several crash reports downloaded from users of my app. Thread 1 apparently crashes while performing a string interpolation. All the other threads only contain calls to system code. The ...
Nickkk's user avatar
  • 2,311
1 vote
0 answers
32 views

App is reading version from main bundle instead of the bundle specified

Consider the following code func fillVersionFor(for aClass: AnyClass, key: String) { let shortVersionStringKey = "CFBundleShortVersionString" let bundle = Bundle(for: aClass) if ...
Anton Tropashko's user avatar
0 votes
0 answers
23 views

Vue3 and foundation : how to make vertical tabs from an array of object?

I am starting with Foundation and rather new to vuejs also. I try to make a tabbed view based on an array of objects namely events (nothing to do with event in the computer science acception but event ...
Meaulnes's user avatar
  • 403
-3 votes
1 answer
71 views

Is Apple Foundation open source?

MacOS calls its core libraries Foundation. This includes a class that stores cookies on the system called HTTPCookieStorage. Is the source code for this class available anywhere for the public? Or are ...
Evan Carroll's user avatar
0 votes
0 answers
11 views

Is there a way to get the data from an Applescript image (AXImage), perhaps using Applescript/Obj-C?

Hi there — I’m writing an Applescript that uses System Events to get an image: tell application “System Events” tell process “appName” tell window 1 set theImage to image 1 ...
Michael Norris's user avatar
0 votes
0 answers
56 views

Why is the result of UInt64.max.formatted(.number) wrong in iOS 16.7 and macOS 13.6

I found UInt64.max.formatted(.number) and UInt.max.formatted(.number) return wrong value in iOS 16.7 and macOS 13.6. Expected: 18,446,744,073,709,551,615 (= 2^64-1) Actual: 9,223,372,036,854,775,807 (...
mtgto's user avatar
  • 521
1 vote
1 answer
45 views

How can we mark function parameters (string literals) as localisable?

I'm writing a convenience init for NSError. extension NSError { public convenience init(domain: String = #file, code: Int = Int(#line), localizedDescription: String) { self.init(domain: ...
Paul B's user avatar
  • 4,187
1 vote
1 answer
67 views

'NSHashTable' requires that 'any MyCustomProtocolAnyObject' be a class type

Curious, why I'm getting this error: If I declare that only objects can conform to the protocol: public protocol DayViewStateUpdating: AnyObject { func move(from oldDate: Date, to newDate: Date) }...
Richard Topchii's user avatar
-1 votes
2 answers
47 views

How expensive NSTimeZone is

How expensive it is to create [NS]TimeZone? Meaning it is cheaper to have a single static let utc = TimeZone(abbreviation: "UTC") or have TimeZone(abbreviation: "UTC") all over ...
Anton Tropashko's user avatar
0 votes
0 answers
9 views

FileManager.containerURL(forSecurityApplicationGroupIdentifier:) returns nil on macOS

I keep getting crash reports in Xcode for one of my macOS apps published on the App Store. Actually it's not the main app that crashes, but the embedded Finder Sync extension. The crash reports ...
Nickkk's user avatar
  • 2,311
-2 votes
1 answer
74 views

I need to wait for a bunch of network APIs to complete. How do I do that? [duplicate]

I am writing an app that needs to make a number of network API calls (which all complete asynchronously, and wait until they all complete before moving on to the next step in my code. How do I do that?...
Duncan C's user avatar
  • 129k
0 votes
0 answers
10 views

foundation xy grid start responsiveness only at certain width

Background: Refer to the image above. It represents a horizontal cross section of page displayed by web browser. It is implemented using zurb foundation xy grid. Notice edges of browser shown in red. ...
shaiksphere's user avatar
0 votes
0 answers
65 views

Localizing plurals when the number is not included in the text

What is the correct way to localize and pluralize a string when the number is not included in the text? I know I can do the following with AttributedString (already a great feature): var count = 3 ...
AndrewC's user avatar
  • 411
0 votes
0 answers
47 views

How do I resolve a dlopen error on foundation in Xcode 14.1?

I am working on a kivy/python app in xcode. The simulator works fine but I get this weird error when I do run it. Furthermore, when I distribute the app to Appstore Connect and run it on testflight, ...
Dale Foerster's user avatar
0 votes
1 answer
55 views

Current count value of DispatchSemaphore

DispatchSemaphore used to restrict the concurrent access on shared resources. It pauses the thread using counter value. Is it possible to get that counter value?
iroh's user avatar
  • 111
1 vote
1 answer
124 views

The purpose behind TimeZone vs NSTimeZone

Why there is a TimeZone with an API significantly different than NSTimeZone? Say NSTimeZone has init(name: String) and TimeZone does not. NSTimeZone has abbreviation property and in TimeZone ...
Anton Tropashko's user avatar
1 vote
2 answers
241 views

Re-render SwiftUI view from event

I have a SwiftUI view whose layout is fully specified by a series of computed properties, but some of those properties change naturally as time goes on. When they've changed enough, there's a ...
Michael Hulet's user avatar
0 votes
0 answers
9 views

Class "Illuminate\Foundation\Auth\URL" not found

URL does not exist in /vendor/laravel/framework/src/Illuminate/Foundation/Auth .composer update did not fix it. error in App  \  Http  \  Middleware  \  RedirectIfAuthenticated use Illuminate\Http\...
Hamid Reza Samiei Nia's user avatar
2 votes
1 answer
117 views

Why does Apple use ContiguousArray in the implementation of Sequence.map?

Why Apple first creates ContiguousArray, then fills it to initialCapacity and then checks that everything is filled and converts the result to Array. Why not just create an Array at once and fill it ...
Pogos Anesyan's user avatar
0 votes
0 answers
42 views

Using CF_SWIFT_NAME to import a C struct getter and setter that bridges to Foundation from Core Foundation

I have a struct, House, that I want usable in both Objective-C and in Swift (additionally, I just wanted to test the bounds of what I could and couldn't import from C to Swift). House is defined as ...
F. S.'s user avatar
  • 1
-1 votes
1 answer
85 views

Does the `Decimal` type have a maximum precision? [duplicate]

I thought the whole point of the Decimal type was arbitrary precision arithmetic. (Or rather I thought that Decimal supported arbitrary precision as well as supporting base-10 arithmetic.) However, an ...
Duncan C's user avatar
  • 129k
0 votes
0 answers
36 views

Can I use CoreFoundation and Foundation methods in C++ in a iOS app

I'm building an iOS app which half of it is in C++ and half in Swift. I wonder if I can import and call methods from CoreFoundation and Foundation in the C++ part of the app without having to call to ...
xarly's user avatar
  • 2,064
1 vote
2 answers
80 views

Why NSDecimalNumber(string:"2175613.285964774433431797660").intValue = 0 , who can help me

Why NSDecimalNumber(string:"2175613.285964774433431797660").intValue = 0 NSDecimalNumber(string:"2175613.285964774433431797660").int32Value = 2175613 NSDecimalNumber(string:"...
hida-cui's user avatar
1 vote
1 answer
28 views

How can I inject HTML into a page without affecting the current page's styles?

I am making page blocks for a third party to copy and paste into their CMS. These HTML page blocks use the foundation framework for styles, but sometimes when foundation is appended to the page it ...
Chris Sopko's user avatar
0 votes
0 answers
19 views

Why doesn't Gulp work in Foundation for Emails framework?

I install Foundation for Emails according to the instructions and go into the project folder by cd F:\mailing\modules. The npm packages didn't install for some reason. Ok, now I'm installing them by ...
Vladikslavus's user avatar
0 votes
0 answers
34 views

Foundation interchange is not working with extension less image

I am trying to use the foundation interchange script to set the background image for a div for different viewport sizes. It works fine with the image with an extension like below https://test.com/is/...
Saravanan Dharmaraj's user avatar
-2 votes
1 answer
50 views

Difference between FloatingPointRoundingRule.down and FloatingPointRoundingRule.towardsZero in Foundation

FloatingPointRoundingRule.down and FloatingPointRoundingRule.towardsZero both are rounded towards zero(rounded to nearest Int value). Then what is difference between them and at which scenario what ...
iroh's user avatar
  • 111
1 vote
1 answer
160 views

How is an integer formatted to a String with comma separators for thousands in Swift? [duplicate]

I want to be able to convert any integer, I'm only using Int and UInt16 at the moment, into a String with a separator to group the thousands, if any. For example the value 12345 as input would output ...
Nate Lockwood's user avatar
0 votes
0 answers
22 views

Foundation 6 Reveal Modal Cause Unwanted Scroll on Close

I have multiple modals on a page built using foundation-sites v6.6.3, modals close fine if clicked outside of. however, when I hit the "close" button or "ESC" key to close the ...
webdecoder's user avatar
0 votes
0 answers
16 views

small-auto class doesn't exist in my foundation 6 grid css

I am using the Foundation 6.6.3. I was trying to use the small-auto class and it doesn't seem to exist in my foundation setup. Any ideas why this might be?
user1666858's user avatar
0 votes
0 answers
26 views

Determining file type in Swift [duplicate]

Because directories are files in macOS and Linux too, I try to determine what type of file it is. This is the code I have so far: import Foundation let filePath = "/Users/Sample/test.ext" ...
Marlene's user avatar
-2 votes
1 answer
41 views

Does On demand resource really persisted after quitting the app?

I have created the NSBundleResourceRequest object as instance member of the class. if i quit the app the request object is deallocatted. According to the apple document if the request object is ...
iroh's user avatar
  • 111
2 votes
0 answers
125 views

How to get the number formatter to work with automatic grammar agreement?

I am having trouble getting the number formatter introduced in iOS 15+, macOS 12+ etc. to work with the automatic grammar agreement. The table below show examples of what I want to achieve. Locale ...
user10711707's user avatar
0 votes
0 answers
62 views

Export attribute on overriden method

I am using a binding library around objective c code. Method generated by Sharpie created the following code: // -(BOOL)shouldRenderAsCluster:(id<GMUCluster> _Nonnull)cluster atZoom:(float)zoom; ...
o_w's user avatar
  • 623
0 votes
0 answers
53 views

Error when trying to set access permissions of file owned by user

I'm trying to copy the access permissions of a source directory to a destination directory. The Finder Info panel of the source directory shows the following permissions: Source directory: I: Read &...
Nickkk's user avatar
  • 2,311
1 vote
2 answers
280 views

How to exit from `RunLoop`

I'm subclassing InputStream from iOS Foundation SDK for my needs. I need to implement functionality that worker thread can sleep until data appear in the stream. The test I'm using to cover the ...
Ihar Katkavets's user avatar
0 votes
0 answers
94 views

CoreData NSPredicate: fetch object with UUID that is contained within a Set<UUID>

I have a CoreData entity with an identifier of type UUID, declared as: @NSManaged public var uuid: UUID? . I want to create a fetch request that would return all entities for which the identifier (...
invalidArgument's user avatar
1 vote
2 answers
479 views

Swift use enum with associated properties in view

I have Enum CategoryType with associated properties and I would like to use it in my view just to list all the cases from enum. I can's use CaseIterable and Identifiable for my enum with associated ...
LDropl's user avatar
  • 858
0 votes
0 answers
44 views

Is there a way to tell when an PHAsset was added to a collection in PhotoKit?

I'm using PHAsset.fetchAssets to retrieve some assets from a PhotoKit collection. I need to be able to tell when an asset was added to a collection. I realize assets have a creationDate and ...
0x6A75616E's user avatar
  • 4,706
8 votes
1 answer
450 views

Why does String.contains behave differently when I import Foundation?

Just started learning Swift, am really confused about the following behaviour. This is what I get when I run String.contains without Foundation: "".contains("") // true "a&...
mingwei's user avatar
  • 93
0 votes
1 answer
124 views

When could the user's Locale.current.region be nil?

The locale region is optional from Foundation. It is my understanding that this property is read from the device under iOS Settings > General > Language & Region > Region. What is the ...
TruMan1's user avatar
  • 34.3k
0 votes
1 answer
364 views

Why does personNameComponents return an incorrect familyName based on the middle name?

In some cases personNameComponents is returning an incorrect family name. Here is a playground example: import UIKit var name = "John Marty Johnson" let formatter = ...
Rudy Folden's user avatar
1 vote
1 answer
281 views

Timer added with scheduledTimer(withTimeInterval works fine with UI interaction

I've scheduled the timer with scheduledTimer(withTimeInterval: 0.008 and it is going on despite the user interaction. This IS the behavior that I want but this article https://www.hackingwithswift.com/...
Anton Tropashko's user avatar
3 votes
1 answer
475 views

URL host deprecated but replacement crashes

URL host was deprecated on iOS 16.1 and macOS 13 but the replacement crashes under certain scenarios. The replacement option is host(percentEncoded:) Example: let url = URL(string: "lorem.com&...
Vicente Garcia's user avatar
0 votes
1 answer
53 views

Unable to get CGRect.null and CGPoint in Package after upgrading to Xcode 14.1

I have a MacOS package dependency which defines some class: FontPens import Foundation ... public class BoundsPen: Pen { var bounds = CGRect.null private var currentPoint = ...
Łukasz's user avatar
  • 783
0 votes
1 answer
89 views

NSDate timeIntervalSinceNow seems to be giving inflated value

In my Obj C code, I want to know the time taken by a completion handler to return result. This is how I measure the duration: NSDate *start = [NSDate date]; [_client asyncCallWithInput:@"INPUT&...
Parth's user avatar
  • 2,820
0 votes
0 answers
130 views

How to get an NSNumber from a String of decimal?

I'm not sure what I'm doing wrong, but NumberFormatter fails to get a number from a simple decimal String when using the number(from:) method. Here's an example: let decimalString: String = "12.5&...
alobaili's user avatar
  • 791
0 votes
1 answer
110 views

How to fix warning for Locale.canonicalIdentifier(from:)

I'm compiling an app for target iOS 14+ When using Locale.canonicalLocaleIdentifier(from:) the compiler shows a warning: 'canonicalLocaleIdentifier(from:)' is deprecated: renamed to 'identifier(_:from:...
benrudhart's user avatar
  • 1,416
2 votes
1 answer
144 views

@autoreleasepool with no foundation or corefoundation (libobjc only)

NOTE: All references to libobjc are referring to Apple's runtime. I'll deal with the GNU runtime later. I'm trying to get a handle on what exactly @autoreleasepool does at runtime so that I can use ...
Jason L.'s user avatar

1
2 3 4 5
20