profile
viewpoint
Dan Federman dfed @airbnb San Francisco https://twitter.com/thefederman Airbnb; formerly Apple and Square

square/Valet 3535

Valet lets you securely store data in the iOS, tvOS, or macOS Keychain without knowing a thing about how the Keychain works. It’s easy. We promise.

airbnb/ResilientDecoding 511

This package makes your Decodable types resilient to decoding errors and allows you to inspect those errors.

square/SuperDelegate 458

SuperDelegate provides a clean application delegate interface and protects you from bugs in the application lifecycle

airbnb/BuckSample 325

An example app showing how Buck can be used to build a simple iOS app.

square/Aardvark 239

Aardvark is a library that makes it dead simple to create actionable bug reports.

dfed/CacheAdvance 22

A performant cache for logging systems. CacheAdvance persists log events 30x faster than SQLite.

dfed/Relativity 21

A programmatic layout engine and DSL that provides an alternative to Auto Layout

airbnb/buck 20

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.

dfed/XCTest-watchOS 18

XCTest-watchOS provides an implementation of XCTest that can run on watchOS

indexzero/celluloid 5

Celluloid is a reactive, input-output oriented language with support for blocks and timelines designed to make both simple and complex media composition operations more comprehensible to the author.

fork aaronn/Swift-YouTube-Player

Swift library for embedding and controlling YouTube videos in your iOS applications!

fork in 2 hours

fork ljharb/proposal-record-tuple

ECMAScript proposal for the Record and Tuple value types. | Stage 2: it will change!

fork in 13 hours

startedbazelbuild/rules_swift

started time in a day

push eventairbnb/BuckSample

Alexander Murphy

commit sha 0dc454cff957caeac465e5eba79f54ab2d6626c7

update window initialization to occur at the correct time in application start up (#140)

view details

push time in a day

PR merged airbnb/BuckSample

Initialize window in the example app's AppDelegate correctly

👋 Greetings!

First of all, great work to everyone who contributed thus far. As a iOS dev new to Buck, this repo has been immensely helpful in learning the best practices.

One thing I noticed is that occasionally when running the example application, the sim will go black and the following is output is visible in the console:

ExampleApp[14655:2132796] [ApplicationLifecycle] UIWindows were created prior to initial application activation. This may result in incorrect visual appearance.

As far as I know, this is a simple change to initialize the window once the appropriate life cycle method is called on the app delegate. Immutable initialization as an instance property cannot ensure that the window is initialized at the right time.

+5 -4

1 comment

1 changed file

thexande

pr closed time in a day

pull request commentdfed/CacheAdvance

CacheAdvance isn't Carthage compatible

Codecov Report

Merging #49 (1ed3341) into main (34524cc) will decrease coverage by 1.39%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
- Coverage   98.05%   96.65%   -1.40%     
==========================================
  Files          12       12              
  Lines         359      359              
==========================================
- Hits          352      347       -5     
- Misses          7       12       +5     
Impacted Files Coverage Δ
Sources/CacheAdvance/FileHandleExtensions.swift 80.00% <0.00%> (-20.00%) :arrow_down:
dfed

comment created time in a day

pull request commentairbnb/BuckSample

Initialize window in the example app's AppDelegate correctly

@shepting do you want to merge if this looks good to you too?

thexande

comment created time in 2 days

PR opened airbnb/BuckSample

Initialize window in the example app's AppDelegate correctly

👋 Greetings!

First of all, great work to everyone who contributed thus far. As a iOS dev new to Buck, this repo has been immensely helpful in learning the best practices.

One thing I noticed is that occasionally when running the example application, the sim will go black and the following is output is visible in the console:

ExampleApp[14655:2132796] [ApplicationLifecycle] UIWindows were created prior to initial application activation. This may result in incorrect visual appearance.

As far as I know, this is a simple change to initialize the window once the appropriate life cycle method is called on the app delegate. Immutable initialization as an instance property cannot ensure that the window is initialized at the right time.

+5 -4

0 comment

1 changed file

pr created time in 2 days

startedgoogle/swift-benchmark

started time in 2 days

startedexcalidraw/excalidraw

started time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {       let x = minXOfMonth(containingItemWithFrame: layoutItem.frame, at: position)       let y = minYOfMonth(containingDayItemWithFrame: layoutItem.frame, atRowInMonth: rowInMonth)       return CGPoint(x: x, y: y)+        +    case .monthFooter(let month):+      let x = layoutItem.frame.origin.x+        let y = layoutItem.frame.minY -+            monthHeaderHeight -+            content.monthDayInsets.top -+            (monthsLayout.pinDaysOfWeekToTop ? 0 : (daySize.height + content.verticalDayMargin)) -+            CGFloat((CGFloat(numberOfRows(in: month)) * daySize.height) + (CGFloat(numberOfRows(in: month) - 1) * content.verticalDayMargin)) -+            content.monthDayInsets.bottom

This is all working as expected now. I will spend some time on implementing some form of footer experience that I could see worthy of this. Do you want me to solely focus on UI presentation of a footer, or actually the UI and logic implementation?

Can see it getting quite intense just for a demo that is all, I'm indifferent, just want some direction on how thought out I should be in the demo.

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {     return CGRect(origin: CGPoint(x: x, y: y), size: daySize)   } +  func frameOfMonthFooter(_ month: Month, inMonthWithOrigin monthOrigin: CGPoint) -> CGRect {+    let x = monthOrigin.x+    let y = monthOrigin.y ++        monthHeaderHeight ++        content.monthDayInsets.top ++        (monthsLayout.pinDaysOfWeekToTop ? 0 : (daySize.height + content.verticalDayMargin)) ++        (CGFloat(numberOfRows(in: month)) * (daySize.height + content.verticalDayMargin))+    return CGRect(origin: CGPoint(x: x, y: y), size: CGSize(width: monthWidth, height: monthFooterHeight ?? 0))

Once #79 is merged, I'll update this branch with the same fixes to accommodate the clean up.

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

+//  Created by Sebastien Audeon on 11/26/20.+//  Copyright © 2020 Airbnb. All rights reserved.++// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++import UIKit+import HorizonCalendar++class SingleDaySelectionFooterDemoViewController: DemoViewController {
  1. I haven't found the need just yet to add a footer to these in my own projects, but I can definitely make an attempt at coming up with something...
saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class LayoutItemTypeEnumerator {       } else {         return .day(calendar.day(byAddingDays: -1, to: day))       }+    +    case .monthFooter(let month):+        let day = calendar.day(containing: calendar.lastDate(of: month))+        return .day(day)

yeah, great idea. We already use that for the Airbnb app repo internally, and it pulls rules from our Swift style guide: https://github.com/airbnb/swift

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class LayoutItemTypeEnumerator {       } else {         return .day(calendar.day(byAddingDays: -1, to: day))       }+    +    case .monthFooter(let month):+        let day = calendar.day(containing: calendar.lastDate(of: month))+        return .day(day)

It's okay! As for enforcing, can look into swiftlint or something similar?

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class LayoutItemTypeEnumerator {       } else {         return .day(calendar.day(byAddingDays: -1, to: day))       }+    +    case .monthFooter(let month):+        let day = calendar.day(containing: calendar.lastDate(of: month))+        return .day(day)

Ah, some more 4 space instead of 2 space indentation. I'll look into enforcing this at the project level. This is probably annoying to deal with, sorry!

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {     size: CGSize,     layoutMargins: NSDirectionalEdgeInsets,     scale: CGFloat,-    monthHeaderHeight: CGFloat)+    monthHeaderHeight: CGFloat,+    monthFooterHeight: CGFloat? = 0.0)
    monthFooterHeight: CGFloat?)
saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 extension CalendarViewContent {         accessibilityTraits: []),       viewModel: .init(text: dayText, accessibilityLabel: accessibilityLabel))   }-+  

nit: remove this diff / added space

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

+//  Created by Sebastien Audeon on 11/26/20.+//  Copyright © 2020 Airbnb. All rights reserved.++// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++import HorizonCalendar+import UIKit++// MARK: CalendarItemViewRepresentable

And for consistency, add the CalendarItemViewRepresentable conformance below so that it looks similar to the DayView file structure.

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

+//  Created by Sebastien Audeon on 11/26/20.+//  Copyright © 2020 Airbnb. All rights reserved.++// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++import HorizonCalendar+import UIKit++// MARK: CalendarItemViewRepresentable
// MARK: - FooterView
saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

+//  Created by Sebastien Audeon on 11/26/20.+//  Copyright © 2020 Airbnb. All rights reserved.++// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++import HorizonCalendar+import UIKit++// MARK: CalendarItemViewRepresentable++class FooterView: CalendarItemViewRepresentable {

nit:

final class FooterView: CalendarItemViewRepresentable {
saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

Bk/reduce frame math duplication

 final class FrameProvider {     return rowOfLastDateInMonth + 1   } +  // Gets the height of day content for a specified number of week rows, including the additional+  // height for vertical day padding.+  // For example, the returned height value for 5 week rows will be 5x the `daySize.height`, plus 4x+  // the `content.verticalDayMargin`.+  private func heightOfDayContent(forNumberOfWeekRows numberOfWeekRows: Int) -> CGFloat {+    (CGFloat(numberOfWeekRows) * daySize.height) ++      (CGFloat(numberOfWeekRows - 1) * content.verticalDayMargin)+  }++  // Gets the height of the days of the week row, plus the padding between it and the first row of+  // days in each month. The returned value will be `0` if+  // `monthsLayout.pinDaysOfWeekToTop == true`.+  private func heightOfDaysOfTheWeekRowInMonth() -> CGFloat {

Very clean! Nice!

bryankeller

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

+//  Created by Sebastien Audeon on 11/26/20.+//  Copyright © 2020 Airbnb. All rights reserved.++// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++import UIKit+import HorizonCalendar++class SingleDaySelectionFooterDemoViewController: DemoViewController {
final class MonthFootersDemoViewController: DemoViewController {

I'd prefer to keep the demos as focused as possible, rather than combining independent concepts like single day selection and month footer configuration. Could we make the following changes (in addition to the naming suggestion above):

  1. Remove all selection related naming / code
  2. Give the footer some more interesting content, rather than just repeating the date in YYYY-MM format. Curious if you have any ideas / inspiration from your own projects of what would be useful in a footer?
  3. Increase the value of monthDayInsets.bottom so that the footer isn't right up against the last week row of the month
  4. Update the indentation to be 2 spaces instead of 4
saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {     return CGRect(origin: CGPoint(x: x, y: y), size: daySize)   } +  func frameOfMonthFooter(_ month: Month, inMonthWithOrigin monthOrigin: CGPoint) -> CGRect {+    let x = monthOrigin.x+    let y = monthOrigin.y ++        monthHeaderHeight ++        content.monthDayInsets.top ++        (monthsLayout.pinDaysOfWeekToTop ? 0 : (daySize.height + content.verticalDayMargin)) ++        (CGFloat(numberOfRows(in: month)) * (daySize.height + content.verticalDayMargin))+    return CGRect(origin: CGPoint(x: x, y: y), size: CGSize(width: monthWidth, height: monthFooterHeight ?? 0))

That's what I am talking about! Very nice indeed!

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {       let x = minXOfMonth(containingItemWithFrame: layoutItem.frame, at: position)       let y = minYOfMonth(containingDayItemWithFrame: layoutItem.frame, atRowInMonth: rowInMonth)       return CGPoint(x: x, y: y)+        +    case .monthFooter(let month):+      let x = layoutItem.frame.origin.x+        let y = layoutItem.frame.minY -+            monthHeaderHeight -+            content.monthDayInsets.top -+            (monthsLayout.pinDaysOfWeekToTop ? 0 : (daySize.height + content.verticalDayMargin)) -+            CGFloat((CGFloat(numberOfRows(in: month)) * daySize.height) + (CGFloat(numberOfRows(in: month) - 1) * content.verticalDayMargin)) -+            content.monthDayInsets.bottom

Be careful of the sign though, this one is subtracting parts of the layout, while the linked comment is adding parts of the layout. It'll be pretty obvious if it's wrong though when you build and run ;)

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {       let x = minXOfMonth(containingItemWithFrame: layoutItem.frame, at: position)       let y = minYOfMonth(containingDayItemWithFrame: layoutItem.frame, atRowInMonth: rowInMonth)       return CGPoint(x: x, y: y)+        +    case .monthFooter(let month):+      let x = layoutItem.frame.origin.x+        let y = layoutItem.frame.minY -+            monthHeaderHeight -+            content.monthDayInsets.top -+            (monthsLayout.pinDaysOfWeekToTop ? 0 : (daySize.height + content.verticalDayMargin)) -+            CGFloat((CGFloat(numberOfRows(in: month)) * daySize.height) + (CGFloat(numberOfRows(in: month) - 1) * content.verticalDayMargin)) -+            content.monthDayInsets.bottom

Similar feedback as here https://github.com/airbnb/HorizonCalendar/pull/75/files#r533051542

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {     return CGRect(origin: CGPoint(x: x, y: y), size: daySize)   } +  func frameOfMonthFooter(_ month: Month, inMonthWithOrigin monthOrigin: CGPoint) -> CGRect {+    let x = monthOrigin.x+    let y = monthOrigin.y ++        monthHeaderHeight ++        content.monthDayInsets.top ++        (monthsLayout.pinDaysOfWeekToTop ? 0 : (daySize.height + content.verticalDayMargin)) ++        (CGFloat(numberOfRows(in: month)) * (daySize.height + content.verticalDayMargin))+    return CGRect(origin: CGPoint(x: x, y: y), size: CGSize(width: monthWidth, height: monthFooterHeight ?? 0))

Also, these complicated calculation are simplified a bit after I merge https://github.com/airbnb/HorizonCalendar/pull/79. Once you pull that into your branch, we can update this to be something like this:

    let numberOfWeekRows = self.numberOfWeekRows(in: month)

    let x = monthOrigin.x
    let y = monthOrigin.y +
      monthHeaderHeight +
      content.monthDayInsets.top +
      heightOfDaysOfTheWeekRowInMonth() +
      heightOfDayContent(forNumberOfWeekRows: numberOfWeekRows) +
      content.monthDayInsets.bottom
    return CGRect(x: x, y: y, width: monthWidth, height: monthFooterHeight ?? 0)
saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {     return CGRect(origin: CGPoint(x: x, y: y), size: daySize)   } +  func frameOfMonthFooter(_ month: Month, inMonthWithOrigin monthOrigin: CGPoint) -> CGRect {+    let x = monthOrigin.x+    let y = monthOrigin.y ++        monthHeaderHeight ++        content.monthDayInsets.top ++        (monthsLayout.pinDaysOfWeekToTop ? 0 : (daySize.height + content.verticalDayMargin)) ++        (CGFloat(numberOfRows(in: month)) * (daySize.height + content.verticalDayMargin))+    return CGRect(origin: CGPoint(x: x, y: y), size: CGSize(width: monthWidth, height: monthFooterHeight ?? 0))

Ah great, I knew I missed something simple.

I wonder if there is a way to make this less intense, the calculations etc...

saudeon

comment created time in 3 days

Pull request review commentairbnb/HorizonCalendar

feat: provide ability to add footer to month

 final class FrameProvider {       let x = minXOfMonth(containingItemWithFrame: layoutItem.frame, at: position)       let y = minYOfMonth(containingDayItemWithFrame: layoutItem.frame, atRowInMonth: rowInMonth)       return CGPoint(x: x, y: y)+        +    case .monthFooter(let month):+      let x = layoutItem.frame.origin.x+        let y = layoutItem.frame.minY -

I personally also like 4, but can fix the indention now!

saudeon

comment created time in 3 days

more